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

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 { getAidList } from "../../service/system";
import { alertInfo, alertSuccess } from "../../utils/index"; import { alertInfo, alertSuccess, loadingFunc } from "../../utils/index";
import request from '../../utils/request' import request from '../../utils/request'
const { OK } = request; const { OK } = request;
@ -32,7 +32,9 @@ Component({
}, },
lifetimes: { lifetimes: {
attached() { attached() {
this.init() loadingFunc(async () => {
await this.init();
})
} }
}, },
/** /**
@ -42,16 +44,14 @@ Component({
async init() { async init() {
const { type, page, size } = this.data; const { type, page, size } = this.data;
const { code, message, data = [], total } = await getAidList(page, size, type); const { code, message, data = [], total } = await getAidList(page, size, type);
console.log('data', data)
if (code !== OK) { if (code !== OK) {
alertInfo(message) alertInfo(message)
return return
} }
this.setData({ this.setData({
list: data, list: data,
total total,
}, () => { totalPage: Math.ceil(total / size)
console.log("this.data", this.data)
}) })
}, },
onRefresh() { onRefresh() {
@ -69,10 +69,21 @@ Component({
url: `/pages/aid/detail/index?id=${id}&type=${type}`, url: `/pages/aid/detail/index?id=${id}&type=${type}`,
}) })
}, },
consult() { consult(e) {
const { id = "" } = e.currentTarget.dataset;
const { type } = this.data;
wx.navigateTo({ 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", "Banner": "/components/banner/index",
"van-image": "@vant/weapp/image/index", "van-image": "@vant/weapp/image/index",
"empty": "/components/empty/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> <div class="title">行业精英</div>
<view wx:if="{{list.length}}"> <view wx:if="{{list.length}}">
<view wx:for="{{list}}" wx:key="id" > <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"> <view class="content">
<van-image <van-image
width="200rpx" width="200rpx"
@ -17,13 +17,18 @@
<view class="userLevel"> {{ item.level }} </view> <view class="userLevel"> {{ item.level }} </view>
</view> </view>
<view class="synopsis"> {{item.synopsis}}{{item.synopsis}} {{item.synopsis}} </view> <view class="synopsis"> {{item.synopsis}}{{item.synopsis}} {{item.synopsis}} </view>
<view class="connect" bind:tap="consult"> <view class="connect" catch:tap="consult" data-id="{{item.id}}">
<van-icon name="service-o" /> <van-icon name="service-o" color="#1989fa" />
<view style="margin-left: 10rpx;"> 在线咨询 </view> <view style="margin-left: 10rpx;color: #1989fa;"> 在线咨询 </view>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
<pagination
currentIndex="{{page}}"
totalPage="{{totalPage}}"
bind:pagingChange="onChangePage"
/>
</view> </view>
<empty wx:else bind:refresh="onRefresh" /> <empty wx:else bind:refresh="onRefresh" />

View File

@ -42,3 +42,17 @@
display: flex; display: flex;
justify-content: flex-end; 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 // pages/aid/consult/index.js
Page({ Page({
@ -12,10 +18,54 @@ Page({
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad(options) { onLoad(options) {
const { type } = options; const { id, type } = options;
this.setData({ type }); 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 required
/> />
<van-field <van-field
value="{{form.name}}" value="{{form.phone}}"
label="手机号" label="手机号"
bind:change="onChange" bind:change="onChange"
data-name="phone" data-name="phone"
@ -25,7 +25,6 @@
label="邮箱" label="邮箱"
bind:change="onChange" bind:change="onChange"
data-name="email" data-name="email"
required
placeholder="请输入邮箱" placeholder="请输入邮箱"
title-width="140rpx" title-width="140rpx"
/> />
@ -33,7 +32,7 @@
value="{{form.detail}}" value="{{form.detail}}"
label="咨询内容" label="咨询内容"
bind:change="onChange" bind:change="onChange"
data-name="email" data-name="detail"
required required
type="textarea" type="textarea"
autosize="{{true}}" autosize="{{true}}"
@ -45,7 +44,7 @@
</view> </view>
</van-cell-group> </van-cell-group>
<view class="submit" wx:if="{{editType === 'edit'}}"> <view class="submit">
<van-button block class="cancelEdit" bind:click="cancelEdit">取消编辑</van-button> <van-button block class="cancelEdit" bind:click="back">返回</van-button>
<van-button type="info" block class="save" bind:click="submit">保存</van-button> <van-button type="info" block class="save" bind:click="submit">保存</van-button>
</view> </view>

View File

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

View File

@ -1,5 +1,5 @@
import { getAidDetail } from "../../../service/system"; import { getAidDetail } from "../../../service/system";
import { alertInfo } from "../../../utils/index"; import { alertInfo, loadingFunc } from "../../../utils/index";
import request from "../../../utils/request" import request from "../../../utils/request"
const { OK } = request; const { OK } = request;
// pages/aid/detail/index.js // pages/aid/detail/index.js
@ -21,8 +21,10 @@ Page({
const that = this; const that = this;
const { type, id } = options; const { type, id } = options;
this.setData({ type, id }, () => { this.setData({ type, id }, () => {
loadingFunc(async () => {
that.init(); that.init();
}) })
})
}, },
async init() { async init() {
@ -36,6 +38,12 @@ Page({
detail: data 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", "aid": "/components/aid/index",
"navigator": "/components/navigator/index", "navigator": "/components/navigator/index",
"mp-html": "/components/mp-html/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" "navigationStyle": "custom"
} }

View File

@ -40,3 +40,6 @@
<mp-html content="{{detail.detail}}" /> <mp-html content="{{detail.detail}}" />
</view> </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: { data: {
user: {}, user: {},
tenement: {},
visible: false, visible: false,
}, },
@ -62,6 +63,8 @@ Page({
} }
this.init() this.init()
this.getUnReadNumber() this.getUnReadNumber()
const tenement = wx.getStorageSync('tenement')
this.setData({ tenement })
}, },
async init() { async init() {
const tenement = wx.getStorageSync('tenement') const tenement = wx.getStorageSync('tenement')
@ -131,5 +134,15 @@ Page({
wx.navigateTo({ wx.navigateTo({
url: '/pages/aid/finance/index', 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", "dot": "/components/dot/index",
"navigator": "/components/navigator/index", "navigator": "/components/navigator/index",
"van-grid": "@vant/weapp/grid/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"
}, },
"navigationBarTitleText": "我的", "navigationBarTitleText": "我的",

View File

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

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