编辑我的页面跳转,完成积分和优惠券页面的创建(内容还没写多少)

This commit is contained in:
qiaomu 2024-12-04 17:30:02 +08:00
parent f6d44a6d33
commit 34c2cb76e7
30 changed files with 566 additions and 12 deletions

View File

@ -27,7 +27,11 @@
"pages/aid/finance/index",
"pages/aid/law/index",
"pages/aid/detail/index",
"pages/aid/consult/index"
"pages/aid/consult/index",
"pages/ticket/index",
"pages/integral/index",
"pages/discountCoupon/index",
"pages/integralRecord/index"
],
"subPackages": [
{

BIN
assets/images/baike.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
assets/images/finance.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
assets/images/law.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View File

@ -28,7 +28,7 @@
}
.synopsis {
height: 80rpx;
height: 75rpx;
overflow: hidden;
margin-top: 20rpx;
margin-bottom: 10rpx;

View File

@ -19,6 +19,8 @@ Component({
* 组件的方法列表
*/
methods: {
handleUse() {
}
}
})

View File

@ -1,4 +1,6 @@
{
"component": true,
"usingComponents": {}
"usingComponents": {
"van-button": "@vant/weapp/button/index"
}
}

View File

@ -1,2 +1,32 @@
<!--components/discountCoupon/index.wxml-->
<text>components/discountCoupon/index.wxml</text>
<view class="wrapper">
<view class="top">
<view class="left">
<view class="typeText">
通用优惠券
</view>
<view class="time">
有效期至2024.12.01
</view>
</view>
<view class="right">
<view class="price">
<text style="font-size: 26rpx;line-height: 26rpx;"> ¥ </text>
<view class="number"> 30 </view>
</view>
<view class="limit">
满30可用
</view>
</view>
</view>
<view class="bottom">
<view class="left">
仅限商城使用
</view>
<view class="right">
<van-button type="info" size="small" bind:tap="handleUse">去使用</van-button>
</view>
</view>
</view>

View File

@ -1 +1,55 @@
/* components/discountCoupon/index.wxss */
/* components/discountCoupon/index.wxss */
.wrapper {
padding: 24rpx;
border-radius: 16rpx;
background-color: #fff;
}
.top {
display: flex;
justify-content: space-between;
border-bottom: 1rpx dashed #ccc;
padding-bottom: 20rpx;
}
.top .right {
color: #fa541c;
}
.price {
display: flex;
align-items: flex-end;
margin-bottom: 14rpx;
}
.typeText {
font-weight: 700;
font-size: 42rpx;
margin-bottom: 20rpx;
}
.time {
font-size: 30rpx;
}
.price {
font-size: 44rpx;
line-height: 44rpx;
}
.limit {
font-size: 30rpx;
}
.bottom {
margin-top: 20rpx;
display: flex;
justify-content: space-between;
align-items: center;
}
.bottom .left {
flex: 1;
font-size: 32rpx;
}

View File

@ -0,0 +1,66 @@
// pages/discountCoupon/index.js
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

View File

@ -0,0 +1,6 @@
{
"usingComponents": {
"navigator": "/components/navigator/index"
},
"navigationStyle": "custom"
}

View File

@ -0,0 +1,2 @@
<!--pages/discountCoupon/index.wxml-->
<navigator title="我的优惠券" canBack="{{true}}" />

View File

@ -0,0 +1 @@
/* pages/discountCoupon/index.wxss */

84
pages/integral/index.js Normal file
View File

@ -0,0 +1,84 @@
// pages/integral/index.js
import request from "../../utils/request"
import { getCurrentIntegral } from "../../service/system";
const { OK } = request;
Page({
/**
* 页面的初始数据
*/
data: {
integral: 0,
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
this.getIntegral();
},
jumpToRecord() {
wx.navigateTo({
url: '/pages/integralRecord/index',
})
},
async getIntegral() {
const { code, message, data } = await getCurrentIntegral();
if (code !== OK) {
alertInfo(message)
return;
}
this.setData({
integral: data?.balance || 0
})
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

View File

@ -0,0 +1,7 @@
{
"usingComponents": {
"navigator": "/components/navigator/index",
"discount-coupon": "/components/discountCoupon/index"
},
"navigationStyle": "custom"
}

11
pages/integral/index.wxml Normal file
View File

@ -0,0 +1,11 @@
<!--pages/integral/index.wxml-->
<navigator title="积分兑换" canBack="{{true}}" />
<view class="integralWrapper">
<view class="currentIntegral">
<view class="number"> 当前积分: {{ integral }} </view>
<view class="primaryTextBtn" bind:tap="jumpToRecord"> 查看积分明细 </view>
</view>
<view class="ticketList">
<discount-coupon />
</view>
</view>

19
pages/integral/index.wxss Normal file
View File

@ -0,0 +1,19 @@
/* pages/integral/index.wxss */
page {
background-color: rgb(242,243,245);
}
.integralWrapper {
padding: 20rpx;
}
.currentIntegral {
font-size: 34rpx;
display: flex;
justify-content: space-between;
}
.ticketList {
margin-top: 20rpx;
}

View File

@ -0,0 +1,89 @@
// pages/integralRecord/index.js
import request from "../../utils/request"
import { getIntegralRecord } from "../../service/system";
import { alertInfo, loadingFunc } from "../../utils";
const { OK } = request;
Page({
/**
* 页面的初始数据
*/
data: {
page: 1,
size: 20,
list: [],
total: 0,
totalPage: 0,
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
async init() {
const { page, size } = this.data;
const { code, message, data, total } = await getIntegralRecord({ page, size })
if (code !== OK) {
alertInfo(message)
return;
}
this.setData({
list: data || [],
total,
totalPage: Math.ceil(total / size),
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
const that = this;
loadingFunc(async () => {
await that.init();
})
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

View File

@ -0,0 +1,6 @@
{
"usingComponents": {
"navigator": "/components/navigator/index"
},
"navigationStyle": "custom"
}

View File

@ -0,0 +1,2 @@
<!--pages/integralRecord/index.wxml-->
<navigator title="积分明细" canBack="{{true}}" />

View File

@ -0,0 +1 @@
/* pages/integralRecord/index.wxss */

View File

@ -4,8 +4,10 @@ import Dialog from '@vant/weapp/dialog/dialog';
import { getUserInfo, logout } from "../../service/user";
import { getDot } from "../../utils/system";
import request from "../../utils/request"
import { getCurrentIntegral } from "../../service/system";
const { OK } = request;
Page({
/**
@ -15,6 +17,7 @@ Page({
user: {},
tenement: {},
visible: false,
integral: 0,
},
/**
@ -63,9 +66,20 @@ Page({
}
this.init()
this.getUnReadNumber()
// this.getIntegral()
const tenement = wx.getStorageSync('tenement')
this.setData({ tenement })
},
async getIntegral() {
const { code, message, data } = await getCurrentIntegral();
if (code !== OK) {
alertInfo(message)
return;
}
this.setData({
integral: data?.balance || 0
})
},
async init() {
const tenement = wx.getStorageSync('tenement')
const result = await getUserInfo(tenement?.id);
@ -86,6 +100,16 @@ Page({
url: '/pages/workBench/index',
})
},
jumpToIntegral() {
wx.navigateTo({
url: '/pages/integral/index',
})
},
jumpToDiscountCoupon() {
wx.navigateTo({
url: '/pages/discountCoupon/index',
})
},
async getUnReadNumber() {
const dot = await getDot();
this.setData({

View File

@ -8,7 +8,8 @@
"navigator": "/components/navigator/index",
"van-grid": "@vant/weapp/grid/index",
"avatar": "/components/avatar/index",
"van-grid-item": "@vant/weapp/grid-item/index"
"van-grid-item": "@vant/weapp/grid-item/index",
"van-image": "@vant/weapp/image/index"
},
"navigationBarTitleText": "我的",
"navigationStyle": "custom"

View File

@ -12,12 +12,61 @@
</view>
</view>
<view style="margin-bottom: 20rpx;border-radius: 16rpx; overflow: hidden;">
<van-grid column-num="3">
<van-grid-item icon="friends-o" text="财税援助" bind:click="jumpToFinance" />
<van-grid-item icon="envelop-o" text="法律援助" bind:click="jumpToLaw" />
<van-grid-item icon="notes-o" text="电力百科" bind:click="jumpToEncyclopedia" />
<van-grid column-num="3" >
<van-grid-item
bind:click="jumpToFinance"
use-slot
>
<van-image
style="margin-top: 20rpx;"
width="140rpx"
height="140rpx"
src="/assets/images/finance.png"
/>
<view style="margin-top: 20rpx;font-size: 34rpx;"> 财税援助 </view>
</van-grid-item>
<van-grid-item
bind:click="jumpToLaw"
use-slot
>
<van-image
width="140rpx"
height="140rpx"
style="margin-top: 20rpx;"
src="/assets/images/law.png"
/>
<view style="margin-top: 20rpx;font-size: 34rpx;"> 法律援助 </view>
</van-grid-item>
<van-grid-item
bind:click="jumpToEncyclopedia"
use-slot
>
<van-image
width="140rpx"
height="140rpx"
style="margin-top: 20rpx;"
src="/assets/images/baike.png"
/>
<view style="margin-top: 20rpx;font-size: 34rpx;"> 电力百科 </view>
</van-grid-item>
</van-grid>
</view>
<!-- <view style="margin-bottom: 20rpx;border-radius: 16rpx; overflow: hidden;">
<van-cell
title="积分兑换"
value=""
is-link
bind:tap="jumpToIntegral"
icon="diamond-o"
/>
<van-cell
title="我的优惠券"
value=""
is-link
bind:tap="jumpToDiscountCoupon"
icon="label-o"
/>
</view> -->
<view style="border-radius: 16rpx; overflow: hidden;">
<van-cell title="联系客服" value="" is-link bind:tap="connect" icon="service-o" />
<van-cell icon="qr" wx:if="{{!!user.isAdmin}}" title="二维码" value="" is-link bind:click="jumpToQrCode" />
@ -29,7 +78,7 @@
</view>
</view>
</van-cell>
<van-cell title="发票抬头" icon="discount-o" value="" is-link bind:tap="jumpToUpdateInvoice">
<van-cell title="发票抬头" icon="notes-o" value="" is-link bind:tap="jumpToUpdateInvoice">
</van-cell>
<van-cell title="绑定企业" icon="exchange" value="" is-link bind:tap="bindTenement" />
<van-cell title="常见问题" icon="question-o" value="" is-link bind:tap="jumpToQuestions" />

66
pages/ticket/index.js Normal file
View File

@ -0,0 +1,66 @@
// pages/ticket/index.js
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

7
pages/ticket/index.json Normal file
View File

@ -0,0 +1,7 @@
{
"usingComponents": {
"navigator": "/components/navigator/index",
"discount-coupon": "/components/discountCoupon/index"
},
"navigationStyle": "custom"
}

3
pages/ticket/index.wxml Normal file
View File

@ -0,0 +1,3 @@
<!--pages/ticket/index.wxml-->
<navigator title="我的优惠券" />
<discount-coupon />

1
pages/ticket/index.wxss Normal file
View File

@ -0,0 +1 @@
/* pages/ticket/index.wxss */

View File

@ -10,6 +10,13 @@
"condition": {
"miniprogram": {
"list": [
{
"name": "pages/ticket/index",
"pathName": "pages/ticket/index",
"query": "",
"launchMode": "default",
"scene": null
},
{
"name": "pages/aid/consult/index",
"pathName": "pages/aid/consult/index",

View File

@ -69,4 +69,14 @@ export const getAidDetail = async function(id) {
// 提交财务/律师援助
export const askAid = async function(data) {
return await POST(`/wx/aid/approve`, data);
}
// 获取当前积分
export const getCurrentIntegral = async function() {
return await GET(`/integral/getWxIntegralList`);
}
// 获取积分明细
export const getIntegralRecord = async function({ page, size }) {
return await GET(`/integral/getWxIntegralList/detail?page=${page}&size=${size}`);
}