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

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

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 */