提交法律援助和财税援助,调整我的页面

This commit is contained in:
qiaomu 2024-11-29 15:36:18 +08:00
parent 520f44a25f
commit 3ad21ea708
15 changed files with 219 additions and 50 deletions

View File

@ -1,5 +1,5 @@
import { getAidList } from "../../service/system";
import { alertInfo, alertSuccess } from "../../utils/index";
import { alertInfo, alertSuccess, loadingFunc } from "../../utils/index";
import request from '../../utils/request'
const { OK } = request;
@ -32,7 +32,9 @@ Component({
},
lifetimes: {
attached() {
this.init()
loadingFunc(async () => {
await this.init();
})
}
},
/**
@ -42,16 +44,14 @@ Component({
async init() {
const { type, page, size } = this.data;
const { code, message, data = [], total } = await getAidList(page, size, type);
console.log('data', data)
if (code !== OK) {
alertInfo(message)
return
}
this.setData({
list: data,
total
}, () => {
console.log("this.data", this.data)
total,
totalPage: Math.ceil(total / size)
})
},
onRefresh() {
@ -69,10 +69,21 @@ Component({
url: `/pages/aid/detail/index?id=${id}&type=${type}`,
})
},
consult() {
consult(e) {
const { id = "" } = e.currentTarget.dataset;
const { type } = this.data;
wx.navigateTo({
url: `/pages/aid/consult/index?id=${this.data.type}`,
url: `/pages/aid/consult/index?id=${id}&type=${type}`,
})
}
},
async onChangePage(e) {
const page = e.detail.currentIndex;
const that = this;
this.setData({
page
}, () => {
that.init();
})
},
}
})

View File

@ -4,6 +4,7 @@
"Banner": "/components/banner/index",
"van-image": "@vant/weapp/image/index",
"empty": "/components/empty/index",
"van-icon": "@vant/weapp/icon/index"
"van-icon": "@vant/weapp/icon/index",
"pagination": "/components/pagination/index"
}
}

View File

@ -3,7 +3,7 @@
<div class="title">行业精英</div>
<view wx:if="{{list.length}}">
<view wx:for="{{list}}" wx:key="id" >
<view class="userInfoItem" mut-bind:tap="jumpToDetail" data-id="{{item.id}}">
<view class="userInfoItem" bind:tap="jumpToDetail" data-id="{{item.id}}">
<view class="content">
<van-image
width="200rpx"
@ -17,13 +17,18 @@
<view class="userLevel"> {{ item.level }} </view>
</view>
<view class="synopsis"> {{item.synopsis}}{{item.synopsis}} {{item.synopsis}} </view>
<view class="connect" bind:tap="consult">
<van-icon name="service-o" />
<view style="margin-left: 10rpx;"> 在线咨询 </view>
<view class="connect" catch:tap="consult" data-id="{{item.id}}">
<van-icon name="service-o" color="#1989fa" />
<view style="margin-left: 10rpx;color: #1989fa;"> 在线咨询 </view>
</view>
</view>
</view>
</view>
</view>
<pagination
currentIndex="{{page}}"
totalPage="{{totalPage}}"
bind:pagingChange="onChangePage"
/>
</view>
<empty wx:else bind:refresh="onRefresh" />

View File

@ -41,4 +41,18 @@
.connect {
display: flex;
justify-content: flex-end;
}
.userName {
width: 150rpx;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.userLevel {
width: 250rpx;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}

View File

@ -1,3 +1,9 @@
import { askAid } from "../../../service/system";
import dayjs from "../../../utils/dayjs";
import { alertInfo, alertSuccess, isValidPhoneNumber, loadingFunc } from "../../../utils/index";
import request from '../../../utils/request'
const { OK } = request
// pages/aid/consult/index.js
Page({
@ -12,10 +18,54 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad(options) {
const { type } = options;
this.setData({ type });
const { id, type } = options;
this.setData({ type: Number(type), id });
},
onChange(e) {
const data = e.detail;
const { name } = e.currentTarget.dataset
const { form } = this.data;
form[name] = data;
this.setData({
form,
})
},
back() {
wx.navigateBack()
},
async submit() {
const { form } = this.data;
const { name, phone, detail } = form;
if (!name) {
alertInfo("请输入名字")
return;
}
if (!phone) {
alertInfo("请输入手机号")
return;
}
if (phone && !isValidPhoneNumber(phone)) {
alertInfo("手机号格式不正确")
return
}
if (!detail) {
alertInfo("请输入详情")
return
}
const that = this;
loadingFunc(async () => {
const { type, id } = that.data;
const { code, message } = await askAid({ ...form, type, createTime: dayjs().format('YYYY-MM-DD HH:mm:ss'), connectId: id })
if (code !== OK) {
alertInfo(message)
return
}
alertSuccess("创建成功")
setTimeout(() => {
wx.navigateBack();
}, 500)
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/

View File

@ -12,7 +12,7 @@
required
/>
<van-field
value="{{form.name}}"
value="{{form.phone}}"
label="手机号"
bind:change="onChange"
data-name="phone"
@ -25,7 +25,6 @@
label="邮箱"
bind:change="onChange"
data-name="email"
required
placeholder="请输入邮箱"
title-width="140rpx"
/>
@ -33,7 +32,7 @@
value="{{form.detail}}"
label="咨询内容"
bind:change="onChange"
data-name="email"
data-name="detail"
required
type="textarea"
autosize="{{true}}"
@ -45,7 +44,7 @@
</view>
</van-cell-group>
<view class="submit" wx:if="{{editType === 'edit'}}">
<van-button block class="cancelEdit" bind:click="cancelEdit">取消编辑</van-button>
<view class="submit">
<van-button block class="cancelEdit" bind:click="back">返回</van-button>
<van-button type="info" block class="save" bind:click="submit">保存</van-button>
</view>

View File

@ -1,8 +1,17 @@
/* pages/aid/consult/index.wxss */
.submit {
margin: 32rpx;
margin-bottom: 50rpx;
display: flex;
align-items: center;
}
margin: 40rpx;
margin-bottom: 50rpx;
display: flex;
align-items: center;
}
.cancelEdit, .save {
flex: 1;
}
.cancelEdit {
margin-right: 40rpx;
}

View File

@ -1,5 +1,5 @@
import { getAidDetail } from "../../../service/system";
import { alertInfo } from "../../../utils/index";
import { alertInfo, loadingFunc } from "../../../utils/index";
import request from "../../../utils/request"
const { OK } = request;
// pages/aid/detail/index.js
@ -21,7 +21,9 @@ Page({
const that = this;
const { type, id } = options;
this.setData({ type, id }, () => {
that.init();
loadingFunc(async () => {
that.init();
})
})
},
@ -36,6 +38,12 @@ Page({
detail: data
})
},
connect() {
const { type, id } = this.data;
wx.navigateTo({
url: `/pages/aid/consult/index?type=${type}&id=${id}`,
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/

View File

@ -3,7 +3,8 @@
"aid": "/components/aid/index",
"navigator": "/components/navigator/index",
"mp-html": "/components/mp-html/index",
"van-field": "@vant/weapp/field/index"
"van-field": "@vant/weapp/field/index",
"van-button": "@vant/weapp/button/index"
},
"navigationStyle": "custom"
}

View File

@ -39,4 +39,7 @@
<view style="margin-top: 20rpx; margin-left: 30rpx;">
<mp-html content="{{detail.detail}}" />
</view>
</van-cell-group>
</van-cell-group>
<view style="margin-top: 40rpx;margin-left: 30rpx;margin-bottom: 30rpx;">
<van-button type="info" block class="save" bind:click="connect">去联系</van-button>
</view>

View File

@ -13,6 +13,7 @@ Page({
*/
data: {
user: {},
tenement: {},
visible: false,
},
@ -62,6 +63,8 @@ Page({
}
this.init()
this.getUnReadNumber()
const tenement = wx.getStorageSync('tenement')
this.setData({ tenement })
},
async init() {
const tenement = wx.getStorageSync('tenement')
@ -131,5 +134,15 @@ Page({
wx.navigateTo({
url: '/pages/aid/finance/index',
})
},
jumpToLaw() {
wx.navigateTo({
url: '/pages/aid/law/index',
})
},
jumpToEncyclopedia() {
wx.navigateTo({
url: '/pages/encyclopedia/index',
})
}
})

View File

@ -7,6 +7,7 @@
"dot": "/components/dot/index",
"navigator": "/components/navigator/index",
"van-grid": "@vant/weapp/grid/index",
"avatar": "/components/avatar/index",
"van-grid-item": "@vant/weapp/grid-item/index"
},
"navigationBarTitleText": "我的",

View File

@ -1,25 +1,39 @@
<!--pages/my/index.wxml-->
<navigator title="我的" />
<van-grid column-num="3">
<van-grid-item icon="friends-o" text="财税援助" bind:click="jumpToFinance" />
<van-grid-item icon="envelop-o" text="法律援助" />
<van-grid-item icon="notes-o" text="电力百科" />
</van-grid>
<van-cell title="联系客服" value="" is-link bind:tap="connect" />
<van-cell wx:if="{{!!user.isAdmin}}" title="二维码" value="" is-link bind:click="jumpToQrCode" />
<van-cell wx:if="{{!!user.isAdmin}}" is-link bind:click="jumpToMember">
<view slot="title">
<view class="cellWrapper">
<view class="text"> 成员管理 </view>
<dot wx:if="{{dot > 0}}" number="{{dot}}" />
<view class="pageWrapper">
<view class="userInfo">
<avatar text="{{ user.nickName }}" />
<view class="info">
<view class="nickName"> {{ user.nickName }} </view>
<view class="tenement"> {{ tenement.name }} </view>
<view class="integration"> 积分: - </view>
</view>
</view>
</van-cell>
<van-cell title="发票抬头" value="" is-link bind:tap="jumpToUpdateInvoice" />
<van-cell title="绑定企业" value="" is-link bind:tap="bindTenement" />
<van-cell title="常见问题" value="" is-link bind:tap="jumpToQuestions" />
<van-cell title="工作台" wx:if="{{user.workStatus}}" value="" is-link bind:tap="jumpToWorkBench" />
<van-cell title="退出登录" value="" is-link bind:tap="logout" />
<view style="margin-bottom: 20rpx;">
<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>
</view>
<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" />
<van-cell icon="friends-o" wx:if="{{!!user.isAdmin}}" is-link bind:click="jumpToMember">
<view slot="title">
<view class="cellWrapper">
<view class="text"> 成员管理 </view>
<dot wx:if="{{dot > 0}}" number="{{dot}}" />
</view>
</view>
</van-cell>
<van-cell title="发票抬头" icon="discount-o" value="" is-link bind:tap="jumpToUpdateInvoice" icon="search">
</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" />
<van-cell title="工作台" icon="records-o" wx:if="{{user.workStatus}}" value="" is-link bind:tap="jumpToWorkBench" />
<van-cell title="退出登录" icon="revoke" value="" is-link bind:tap="logout" />
<van-dialog id="van-dialog" />
<van-dialog id="van-dialog" />
</view>

View File

@ -4,3 +4,38 @@
justify-content: space-between;
}
.pageWrapper {
padding: 24rpx;
background: linear-gradient(to bottom, var(--middle-green), #fff );
}
.userInfo {
display: flex;
align-items: center;
padding: 24rpx;
background-color: #fff;
margin-bottom: 24rpx;
overflow: hidden;
}
.userInfo .info {
margin-left: 30rpx;
flex: 1;
}
.userInfo .info .nickName {
font-size: 34rpx;
font-weight: 700;
}
.userInfo .info .tenement {
font-size: 28rpx;
margin-top: 6rpx;
}
.integration {
font-size: 28rpx;
margin-top: 6rpx;
}

View File

@ -64,4 +64,9 @@ export const getAidList = async function(page = 1, size = 10, type = 0) {
// 获取财务/律师援助详情
export const getAidDetail = async function(id) {
return await GET(`/aid/detail/${id}`);
}
// 提交财务/律师援助
export const askAid = async function(data) {
return await POST(`/wx/aid/approve`, data);
}