开始做充值和发票
This commit is contained in:
parent
e5c9a96353
commit
7648ace524
18
app.json
18
app.json
@ -1,13 +1,17 @@
|
|||||||
{
|
{
|
||||||
"pages": [
|
"pages": [
|
||||||
"pages/login/index",
|
"pages/invoiceList/index",
|
||||||
"pages/my/index",
|
|
||||||
"pages/recharge/index",
|
|
||||||
"pages/rechargeRecord/index",
|
"pages/rechargeRecord/index",
|
||||||
"pages/questions/index",
|
|
||||||
"pages/meterList/index",
|
"pages/meterList/index",
|
||||||
|
"pages/recharge/index",
|
||||||
|
"pages/login/index",
|
||||||
|
"pages/handleLogin/index",
|
||||||
|
"pages/member/index",
|
||||||
|
"pages/my/index",
|
||||||
|
"pages/questions/index",
|
||||||
"pages/home/index",
|
"pages/home/index",
|
||||||
"pages/index/index"
|
"pages/index/index",
|
||||||
|
"pages/qrCode/index"
|
||||||
],
|
],
|
||||||
"tabBar": {
|
"tabBar": {
|
||||||
"list": [
|
"list": [
|
||||||
@ -27,8 +31,6 @@
|
|||||||
"navigationBarBackgroundColor": "#ffffff"
|
"navigationBarBackgroundColor": "#ffffff"
|
||||||
},
|
},
|
||||||
"sitemapLocation": "sitemap.json",
|
"sitemapLocation": "sitemap.json",
|
||||||
"rendererOptions": {
|
"rendererOptions": {},
|
||||||
|
|
||||||
},
|
|
||||||
"navigationStyle": "custom"
|
"navigationStyle": "custom"
|
||||||
}
|
}
|
10
app.wxss
10
app.wxss
@ -17,5 +17,13 @@ page {
|
|||||||
|
|
||||||
page {
|
page {
|
||||||
font-size: 36rpx;
|
font-size: 36rpx;
|
||||||
background-color: #f0f0f0;
|
/* background-color: #f0f0f0; */
|
||||||
|
}
|
||||||
|
|
||||||
|
.primaryTextBtn {
|
||||||
|
color: #1989fa;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dangerTextBtn {
|
||||||
|
color: #ee0a24;
|
||||||
}
|
}
|
BIN
assets/images/logo-l.png
Normal file
BIN
assets/images/logo-l.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.4 KiB |
BIN
assets/images/logo.jpg
Normal file
BIN
assets/images/logo.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 23 KiB |
@ -1,3 +1,8 @@
|
|||||||
|
import { getParkList } from "../../service/park";
|
||||||
|
import { getTenementList } from "../../service/tenement";
|
||||||
|
import request from '../../utils/request'
|
||||||
|
|
||||||
|
const { OK } = request
|
||||||
// components/select/index.js
|
// components/select/index.js
|
||||||
Component({
|
Component({
|
||||||
|
|
||||||
@ -5,7 +10,11 @@ Component({
|
|||||||
* 组件的属性列表
|
* 组件的属性列表
|
||||||
*/
|
*/
|
||||||
properties: {
|
properties: {
|
||||||
|
label: String,
|
||||||
|
type: Number,
|
||||||
|
park: String,
|
||||||
|
parkName: String,
|
||||||
|
required: Boolean
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -13,19 +22,39 @@ Component({
|
|||||||
*/
|
*/
|
||||||
data: {
|
data: {
|
||||||
list: [],
|
list: [],
|
||||||
visible: false
|
visible: false,
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 组件的方法列表
|
* 组件的方法列表
|
||||||
*/
|
*/
|
||||||
methods: {
|
methods: {
|
||||||
onInput(e) {
|
async onInput(e) {
|
||||||
console.log('e', e)
|
console.log('this.type', this.data.type)
|
||||||
|
// this.setData({
|
||||||
|
// visible: true,
|
||||||
|
// list: [e.detail, e.detail, e.detail]
|
||||||
|
// })
|
||||||
|
switch(this.data.type) {
|
||||||
|
case 0:
|
||||||
|
const { data = [], code, message } = await getParkList({ keyword: e.detail });
|
||||||
this.setData({
|
this.setData({
|
||||||
|
list: data,
|
||||||
visible: true,
|
visible: true,
|
||||||
list: [e.detail, e.detail, e.detail]
|
|
||||||
})
|
})
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
const park = this.data.park;
|
||||||
|
if (!park) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const { data: tenementData = [], code: tenementCode, message: tenementMessage } = await getTenementList({ park, keyword: e.detail });
|
||||||
|
this.setData({
|
||||||
|
list: tenementData,
|
||||||
|
visible: true,
|
||||||
|
})
|
||||||
|
break;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
close() {
|
close() {
|
||||||
this.setData({
|
this.setData({
|
||||||
@ -35,11 +64,11 @@ Component({
|
|||||||
},
|
},
|
||||||
onChoose(e) {
|
onChoose(e) {
|
||||||
const { data = {} } = e.currentTarget.dataset;
|
const { data = {} } = e.currentTarget.dataset;
|
||||||
console.log('data', data)
|
|
||||||
this.setData({
|
this.setData({
|
||||||
visible: false
|
visible: false,
|
||||||
|
value: data.name
|
||||||
})
|
})
|
||||||
this.triggerEvent("choose", data)
|
this.triggerEvent("choose", {type: this.data.type, data})
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
})
|
})
|
@ -2,16 +2,16 @@
|
|||||||
<view class="content">
|
<view class="content">
|
||||||
<van-field
|
<van-field
|
||||||
value="{{ value }}"
|
value="{{ value }}"
|
||||||
placeholder="请输入用户名"
|
placeholder="{{'请选择' + label}}"
|
||||||
border="{{ false }}"
|
border="{{ false }}"
|
||||||
label="用户名"
|
label="{{label}}"
|
||||||
custom-style="height:100rpx"
|
custom-style="height:100rpx"
|
||||||
bind:change="onChange"
|
|
||||||
bind:input="onInput"
|
bind:input="onInput"
|
||||||
|
required="{{required}}"
|
||||||
/>
|
/>
|
||||||
<view class="modal" wx:if="{{visible}}">
|
<view class="modal" wx:if="{{visible}}">
|
||||||
<view class="options" >
|
<view class="options">
|
||||||
<view wx:for="{{list}}" class="option" bind:tap="onChoose" data-data="{{item}}">{{item}}</view>
|
<view wx:for="{{list}}" class="option" bind:tap="onChoose" data-data="{{item}}" wx:key="id">{{item.name}}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="other" bind:tap="close"></view>
|
<view class="other" bind:tap="close"></view>
|
||||||
</view>
|
</view>
|
||||||
|
@ -8,7 +8,13 @@
|
|||||||
|
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
padding: 20rpx;
|
padding: 20rpx;
|
||||||
|
margin-left: 32rpx;
|
||||||
|
margin-right: 32rpx;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
border: 1rpx solid #ccc;
|
||||||
|
border-radius: 5rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
width: calc(100% - 64rpx);
|
||||||
}
|
}
|
||||||
|
|
||||||
.option {
|
.option {
|
||||||
|
24
components/topbar/index.js
Normal file
24
components/topbar/index.js
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
// components/topbar/index.js
|
||||||
|
Component({
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 组件的属性列表
|
||||||
|
*/
|
||||||
|
properties: {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 组件的初始数据
|
||||||
|
*/
|
||||||
|
data: {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 组件的方法列表
|
||||||
|
*/
|
||||||
|
methods: {
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
6
components/topbar/index.json
Normal file
6
components/topbar/index.json
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"component": true,
|
||||||
|
"usingComponents": {
|
||||||
|
"van-image": "@vant/weapp/image/index"
|
||||||
|
}
|
||||||
|
}
|
5
components/topbar/index.wxml
Normal file
5
components/topbar/index.wxml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<!--components/topbar/index.wxml-->
|
||||||
|
<view class="wrapper">
|
||||||
|
<van-image width="100rpx" height="100rpx" src="/assets/images/logo-l.png" />
|
||||||
|
<view class="content"> 华昌宝能用电管理服务 </view>
|
||||||
|
</view>
|
12
components/topbar/index.wxss
Normal file
12
components/topbar/index.wxss
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
/* components/topbar/index.wxss */
|
||||||
|
|
||||||
|
.wrapper {
|
||||||
|
padding: 12rpx 32rpx;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content {
|
||||||
|
margin-left: 50rpx;
|
||||||
|
}
|
||||||
|
|
138
pages/handleLogin/index.js
Normal file
138
pages/handleLogin/index.js
Normal file
@ -0,0 +1,138 @@
|
|||||||
|
import { userValidate } from "../../service/user";
|
||||||
|
import { alertInfo, alertSuccess, loadingFunc, wxLogin } from "../../utils/index";
|
||||||
|
import request from "../../utils/request"
|
||||||
|
const { OK } = request;
|
||||||
|
// pages/handleLogin/index.js
|
||||||
|
Page({
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面的初始数据
|
||||||
|
*/
|
||||||
|
data: {
|
||||||
|
phone: "",
|
||||||
|
name: "",
|
||||||
|
parkName: "",
|
||||||
|
park: "",
|
||||||
|
tenementName: "",
|
||||||
|
tenement: ""
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面加载
|
||||||
|
*/
|
||||||
|
onLoad(options) {
|
||||||
|
|
||||||
|
},
|
||||||
|
onChangeName(e) {
|
||||||
|
this.setData({
|
||||||
|
name: e.detail
|
||||||
|
})
|
||||||
|
},
|
||||||
|
onChangePhone(e) {
|
||||||
|
this.setData({
|
||||||
|
phone: e.detail
|
||||||
|
})
|
||||||
|
},
|
||||||
|
onChoosePark(e) {
|
||||||
|
const { data } = e.detail;
|
||||||
|
this.setData({
|
||||||
|
park: data.id,
|
||||||
|
parkName: data.name
|
||||||
|
})
|
||||||
|
},
|
||||||
|
onChooseTenement(e) {
|
||||||
|
const { data } = e.detail;
|
||||||
|
this.setData({
|
||||||
|
tenement: data.id,
|
||||||
|
tenementName: data.name
|
||||||
|
})
|
||||||
|
},
|
||||||
|
handleSubmit() {
|
||||||
|
const { park, tenement, name, phone } = this.data;
|
||||||
|
if (!park) {
|
||||||
|
alertInfo("请选择园区")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (!tenement) {
|
||||||
|
alertInfo("请选择商户")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (!phone) {
|
||||||
|
alertInfo("请输入联系人手机号")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (!name) {
|
||||||
|
alertInfo("请输入你的昵称")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
loadingFunc(async () => {
|
||||||
|
const wxLoginCode = await wxLogin()
|
||||||
|
const { code, message, data } = await userValidate({ park, tenement, phone, name, code: wxLoginCode })
|
||||||
|
// if (code !== OK) {
|
||||||
|
// alertInfo(message)
|
||||||
|
// return
|
||||||
|
// }
|
||||||
|
const { exist, user } = data;
|
||||||
|
if (!exist) {
|
||||||
|
alertInfo("绑定失败,请检查信息")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
alertSuccess("绑定成功")
|
||||||
|
const { token, ...currentUser } = user;
|
||||||
|
wx.setStorageSync('user', currentUser)
|
||||||
|
wx.setStorageSync('token', token)
|
||||||
|
wx.switchTab({
|
||||||
|
url: '/pages/home/index',
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面初次渲染完成
|
||||||
|
*/
|
||||||
|
onReady() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面显示
|
||||||
|
*/
|
||||||
|
onShow() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面隐藏
|
||||||
|
*/
|
||||||
|
onHide() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面卸载
|
||||||
|
*/
|
||||||
|
onUnload() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面相关事件处理函数--监听用户下拉动作
|
||||||
|
*/
|
||||||
|
onPullDownRefresh() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面上拉触底事件的处理函数
|
||||||
|
*/
|
||||||
|
onReachBottom() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户点击右上角分享
|
||||||
|
*/
|
||||||
|
onShareAppMessage() {
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
9
pages/handleLogin/index.json
Normal file
9
pages/handleLogin/index.json
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"usingComponents": {
|
||||||
|
"topbar": "/components/topbar/index",
|
||||||
|
"select": "/components/select/index",
|
||||||
|
"van-button": "@vant/weapp/button/index",
|
||||||
|
"van-field": "@vant/weapp/field/index"
|
||||||
|
},
|
||||||
|
"navigationBarTitleText": "手动绑定"
|
||||||
|
}
|
25
pages/handleLogin/index.wxml
Normal file
25
pages/handleLogin/index.wxml
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
<!--pages/handleLogin/index.wxml-->
|
||||||
|
<topbar />
|
||||||
|
<view>
|
||||||
|
<select label="园区" type="0" bind:choose="onChoosePark" park="{{park}}" parkName="{{parkName}}" required="{{true}}" />
|
||||||
|
<select label="公司名称" type="1" bind:choose="onChooseTenement" park="{{park}}" tenement="{{tenement}}" tenementName="{{tenementName}}" required="{{true}}" />
|
||||||
|
<van-field
|
||||||
|
required
|
||||||
|
value="{{ phone }}"
|
||||||
|
label="联系人手机号"
|
||||||
|
placeholder="请输入联系人手机号"
|
||||||
|
border="{{ false }}"
|
||||||
|
bind:change="onChangePhone"
|
||||||
|
/>
|
||||||
|
<van-field
|
||||||
|
required
|
||||||
|
value="{{ name }}"
|
||||||
|
label="你的昵称"
|
||||||
|
placeholder="请输入你的昵称"
|
||||||
|
border="{{ false }}"
|
||||||
|
bind:change="onChangeName"
|
||||||
|
/>
|
||||||
|
<view class="submit">
|
||||||
|
<van-button type="info" block bind:click="handleSubmit"> 提交 </van-button>
|
||||||
|
</view>
|
||||||
|
</view>
|
5
pages/handleLogin/index.wxss
Normal file
5
pages/handleLogin/index.wxss
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
/* pages/handleLogin/index.wxss */
|
||||||
|
.submit {
|
||||||
|
margin-top: 40rpx;
|
||||||
|
padding: 0 32rpx;
|
||||||
|
}
|
@ -1,2 +1,2 @@
|
|||||||
<!--pages/home/index.wxml-->
|
<!--pages/home/index.wxml-->
|
||||||
111111111111111
|
首页
|
@ -9,13 +9,13 @@ Page({
|
|||||||
staffC: {firstName: 'Gideon', lastName: 'Lin'}
|
staffC: {firstName: 'Gideon', lastName: 'Lin'}
|
||||||
},
|
},
|
||||||
onLoad() {
|
onLoad() {
|
||||||
console.log('---', this.renderer)
|
|
||||||
},
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
|
|
||||||
},
|
},
|
||||||
test: throttle(function() {
|
test: throttle(function() {
|
||||||
console.log('test', this.data.motto)
|
|
||||||
}, 500),
|
}, 500),
|
||||||
payment: function() {
|
payment: function() {
|
||||||
wx.requestPayment({
|
wx.requestPayment({
|
||||||
|
66
pages/invoiceList/index.js
Normal file
66
pages/invoiceList/index.js
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
// pages/invoiceList/index.js
|
||||||
|
Page({
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面的初始数据
|
||||||
|
*/
|
||||||
|
data: {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面加载
|
||||||
|
*/
|
||||||
|
onLoad(options) {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面初次渲染完成
|
||||||
|
*/
|
||||||
|
onReady() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面显示
|
||||||
|
*/
|
||||||
|
onShow() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面隐藏
|
||||||
|
*/
|
||||||
|
onHide() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面卸载
|
||||||
|
*/
|
||||||
|
onUnload() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面相关事件处理函数--监听用户下拉动作
|
||||||
|
*/
|
||||||
|
onPullDownRefresh() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面上拉触底事件的处理函数
|
||||||
|
*/
|
||||||
|
onReachBottom() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户点击右上角分享
|
||||||
|
*/
|
||||||
|
onShareAppMessage() {
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
4
pages/invoiceList/index.json
Normal file
4
pages/invoiceList/index.json
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"usingComponents": {},
|
||||||
|
"navigationBarTitleText": "开票信息"
|
||||||
|
}
|
2
pages/invoiceList/index.wxml
Normal file
2
pages/invoiceList/index.wxml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
<!--pages/invoiceList/index.wxml-->
|
||||||
|
<text>pages/invoiceList/index.wxml</text>
|
1
pages/invoiceList/index.wxss
Normal file
1
pages/invoiceList/index.wxss
Normal file
@ -0,0 +1 @@
|
|||||||
|
/* pages/invoiceList/index.wxss */
|
@ -1,6 +1,9 @@
|
|||||||
import { login } from "../../service/user"
|
import { login } from "../../service/user";
|
||||||
import { alertError, alertInfo, loadingFunc, wxLogin } from "../../utils/index"
|
import { alertError, alertInfo, alertSuccess, loadingFunc, wxLogin } from "../../utils/index";
|
||||||
import { OK } from "../../utils/request"
|
import request from "../../utils/request";
|
||||||
|
import Dialog from '@vant/weapp/dialog/dialog';
|
||||||
|
const { OK } = request;
|
||||||
|
|
||||||
// pages/login/index.js
|
// pages/login/index.js
|
||||||
Page({
|
Page({
|
||||||
|
|
||||||
@ -8,14 +11,22 @@ Page({
|
|||||||
* 页面的初始数据
|
* 页面的初始数据
|
||||||
*/
|
*/
|
||||||
data: {
|
data: {
|
||||||
input: ""
|
input: "",
|
||||||
|
disabled: false,
|
||||||
|
show: false,
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生命周期函数--监听页面加载
|
* 生命周期函数--监听页面加载
|
||||||
*/
|
*/
|
||||||
onLoad(options) {
|
onLoad() {
|
||||||
|
const user = wx.getStorageSync('user')
|
||||||
|
if (!user || !user.id) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
wx.switchTab({
|
||||||
|
url: '/pages/home/index',
|
||||||
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -27,40 +38,67 @@ Page({
|
|||||||
onClose() {
|
onClose() {
|
||||||
// wx.exitMiniProgram()
|
// wx.exitMiniProgram()
|
||||||
},
|
},
|
||||||
// onConfirm() {
|
onConfirm() {
|
||||||
// this.handleLogin()
|
// this.handleLogin()
|
||||||
// },
|
},
|
||||||
async handleLogin(phoneCode) {
|
async handleLogin(phoneCode) {
|
||||||
loadingFunc(async () => {
|
loadingFunc(async () => {
|
||||||
const wxLoginCode = await wxLogin()
|
const wxLoginCode = await wxLogin()
|
||||||
const { code, message, data } = await login({ code: wxLoginCode, phoneCode })
|
const result = await login({ code: wxLoginCode, phoneCode })
|
||||||
|
const { code, message, data } = result;
|
||||||
if (code !== OK) {
|
if (code !== OK) {
|
||||||
alertError(message)
|
alertError(message)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
console.log('data', data)
|
if (!data?.id) {
|
||||||
|
this.noPermission()
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
alertSuccess("登录成功")
|
||||||
|
const { token, ...user } = data
|
||||||
|
wx.setStorageSync('user', user)
|
||||||
|
wx.setStorageSync('token', data?.token)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
getPhoneNumber(e) {
|
getPhoneNumber(e) {
|
||||||
const { errno, code: phoneCode } = e.detail;
|
const { errno, code: phoneCode } = e.detail;
|
||||||
console.log('errno', errno, 'phoneCode', phoneCode)
|
|
||||||
switch(errno) {
|
switch(errno) {
|
||||||
case 103:
|
case 103:
|
||||||
alertInfo("已拒绝");
|
alertInfo("已拒绝");
|
||||||
setTimeout(() => {
|
|
||||||
wx.exitMiniProgram()
|
|
||||||
}, 100)
|
|
||||||
return;
|
return;
|
||||||
break;
|
|
||||||
case 1400001:
|
case 1400001:
|
||||||
alertInfo("服务达到上限")
|
alertInfo("服务达到上限")
|
||||||
setTimeout(() => {
|
|
||||||
wx.exitMiniProgram()
|
|
||||||
}, 100)
|
|
||||||
return;
|
return;
|
||||||
break;
|
default:
|
||||||
}
|
|
||||||
this.handleLogin(phoneCode)
|
this.handleLogin(phoneCode)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onChangeAgree(e) {
|
||||||
|
this.setData({
|
||||||
|
agree: e.detail
|
||||||
|
})
|
||||||
|
},
|
||||||
|
beforeClose(e) {
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
noPermission() {
|
||||||
|
Dialog.confirm({
|
||||||
|
title: '提示',
|
||||||
|
message: '当前手机号不是用电管理联系账号',
|
||||||
|
confirmButtonText: '手动绑定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
// on confirm
|
||||||
|
wx.navigateTo({
|
||||||
|
url: '/pages/handleLogin/index',
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
// on cancel
|
||||||
|
});
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* 生命周期函数--监听页面显示
|
* 生命周期函数--监听页面显示
|
||||||
|
@ -1,6 +1,11 @@
|
|||||||
{
|
{
|
||||||
"usingComponents": {
|
"usingComponents": {
|
||||||
"van-dialog": "@vant/weapp/dialog/index",
|
"van-dialog": "@vant/weapp/dialog/index",
|
||||||
"select": "/components/select/index"
|
"select": "/components/select/index",
|
||||||
}
|
"topbar": "/components/topbar/index",
|
||||||
|
"van-image": "@vant/weapp/image/index",
|
||||||
|
"van-button": "@vant/weapp/button/index",
|
||||||
|
"van-checkbox": "@vant/weapp/checkbox/index"
|
||||||
|
},
|
||||||
|
"navigationBarTitleText": ""
|
||||||
}
|
}
|
@ -1,19 +1,20 @@
|
|||||||
<!--pages/login/index.wxml-->
|
<topbar />
|
||||||
<view class="content">
|
<view class="content">
|
||||||
<van-dialog
|
<view class="logo">
|
||||||
use-slot
|
<van-image width="200rpx" height="200rpx" src="/assets/images/logo-l.png" />
|
||||||
title="提示"
|
</view>
|
||||||
show="{{ true }}"
|
<view class="logoBtn">
|
||||||
show-cancel-button
|
<van-button type="info" block disabled="{{!agree}}" open-type="getPhoneNumber" bind:getphonenumber="getPhoneNumber">手机号快速登录</van-button>
|
||||||
bind:close="onClose"
|
</view>
|
||||||
bind:confirm="onConfirm"
|
<view class="agreement">
|
||||||
confirm-button-open-type="getPhoneNumber"
|
<view class="checkbox">
|
||||||
bind:getphonenumber="getPhoneNumber"
|
<van-checkbox value="{{ agree }}" bind:change="onChangeAgree"></van-checkbox>
|
||||||
>
|
</view>
|
||||||
<view class="confirmWrapper">
|
<view>
|
||||||
使用本系统,代表您已阅读并同意 <text class="agreementText">《用电管理服务条款》</text>、<text class="agreementText">《用电管理登录政策》</text><text class="agreementText">《隐私政策》</text>。
|
使用本系统,代表您已阅读并同意 <text class="agreementText">《用电管理服务条款》</text>、<text class="agreementText">《用电管理登录政策》</text><text class="agreementText">《隐私政策》</text>。
|
||||||
</view>
|
</view>
|
||||||
</van-dialog>
|
</view>
|
||||||
<!-- <select />
|
|
||||||
<select /> -->
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
<van-dialog id="van-dialog" />
|
||||||
|
|
||||||
|
@ -1,15 +1,7 @@
|
|||||||
/* pages/login/index.wxss */
|
/* pages/login/index.wxss */
|
||||||
.content {
|
|
||||||
/* width: 600rpx;
|
page {
|
||||||
height: 500rpx;
|
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
position: fixed;
|
|
||||||
left: 0;
|
|
||||||
right: 0;
|
|
||||||
top: 0;
|
|
||||||
bottom: 0;
|
|
||||||
margin: auto;
|
|
||||||
padding: 20rpx 24rpx; */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.confirmWrapper {
|
.confirmWrapper {
|
||||||
@ -19,3 +11,24 @@
|
|||||||
.agreementText {
|
.agreementText {
|
||||||
color: rgb(211, 155, 52);
|
color: rgb(211, 155, 52);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.logo {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
margin-top: 15vh;
|
||||||
|
margin-bottom: 15vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content {
|
||||||
|
margin-left: 32rpx;
|
||||||
|
margin-right: 32rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.agreement {
|
||||||
|
margin-top: 32rpx;
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
.checkbox {
|
||||||
|
margin-top: 6rpx;
|
||||||
|
}
|
64
pages/member/components/approveMember/index.js
Normal file
64
pages/member/components/approveMember/index.js
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
import { approveUser, getApproveList } from "../../../../service/user"
|
||||||
|
import { alertInfo, alertSuccess, wxModal } from "../../../../utils/index";
|
||||||
|
import request from "../../../../utils/request"
|
||||||
|
|
||||||
|
const { OK } = request;
|
||||||
|
|
||||||
|
Component({
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 组件的属性列表
|
||||||
|
*/
|
||||||
|
properties: {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 组件的初始数据
|
||||||
|
*/
|
||||||
|
data: {
|
||||||
|
list: []
|
||||||
|
},
|
||||||
|
lifetimes: {
|
||||||
|
attached: function() {
|
||||||
|
// this.setData({
|
||||||
|
// list: []
|
||||||
|
// })
|
||||||
|
this.init();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 组件的方法列表
|
||||||
|
*/
|
||||||
|
methods: {
|
||||||
|
async init() {
|
||||||
|
const result = await getApproveList()
|
||||||
|
this.setData({
|
||||||
|
list: result.data
|
||||||
|
})
|
||||||
|
},
|
||||||
|
async agree(e) {
|
||||||
|
const { user } = e.currentTarget.dataset;
|
||||||
|
console.log('user', user)
|
||||||
|
await wxModal({ content: `同意${user.nickName}的申请?` })
|
||||||
|
const { code, message } = await approveUser({ userId: user.id, type: 1 })
|
||||||
|
if (code !== OK) {
|
||||||
|
alertInfo(message)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
alertSuccess("已同意")
|
||||||
|
this.init()
|
||||||
|
},
|
||||||
|
async disAgree(e) {
|
||||||
|
const { user } = e.currentTarget.dataset;
|
||||||
|
await wxModal({ content: `拒绝${user.nickName}的申请?` })
|
||||||
|
const { code, message } = await approveUser({ userId: user.id, type: 0 })
|
||||||
|
if (code !== OK) {
|
||||||
|
alertInfo(message)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
alertSuccess("已拒绝")
|
||||||
|
this.init()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
4
pages/member/components/approveMember/index.json
Normal file
4
pages/member/components/approveMember/index.json
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"component": true,
|
||||||
|
"usingComponents": {}
|
||||||
|
}
|
8
pages/member/components/approveMember/index.wxml
Normal file
8
pages/member/components/approveMember/index.wxml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<!--pages/member/components/approveMember/index.wxml-->
|
||||||
|
<view wx:for="{{list}}" wx:key="index" wx:for-item="item" class="item">
|
||||||
|
<view class="nickName"> {{ item.nickName }} </view>
|
||||||
|
<view class="operate">
|
||||||
|
<view class="primaryTextBtn" data-user="{{item}}" bind:tap="agree"> 同意 </view>
|
||||||
|
<view class="disAgree dangerTextBtn" data-user="{{item}}" bind:tap="disAgree"> 拒绝 </view>
|
||||||
|
</view>
|
||||||
|
</view>
|
21
pages/member/components/approveMember/index.wxss
Normal file
21
pages/member/components/approveMember/index.wxss
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
/* pages/member/components/approveMember/index.wxss */
|
||||||
|
.item {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
padding-top: 24rpx;
|
||||||
|
padding-bottom: 24rpx;
|
||||||
|
margin-left: 32rpx;
|
||||||
|
margin-right: 32rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nickName {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.operate {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
.disAgree {
|
||||||
|
margin-left: 24rpx;
|
||||||
|
}
|
65
pages/member/components/memberManage/index.js
Normal file
65
pages/member/components/memberManage/index.js
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
import { approveUser, getApproveList } from "../../../../service/user"
|
||||||
|
import { alertInfo, alertSuccess, wxModal } from "../../../../utils/index";
|
||||||
|
import request from "../../../../utils/request"
|
||||||
|
|
||||||
|
const { OK } = request;
|
||||||
|
|
||||||
|
Component({
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 组件的属性列表
|
||||||
|
*/
|
||||||
|
properties: {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 组件的初始数据
|
||||||
|
*/
|
||||||
|
data: {
|
||||||
|
list: []
|
||||||
|
},
|
||||||
|
lifetimes: {
|
||||||
|
attached: function() {
|
||||||
|
// this.setData({
|
||||||
|
// list: []
|
||||||
|
// })
|
||||||
|
this.init();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 组件的方法列表
|
||||||
|
*/
|
||||||
|
methods: {
|
||||||
|
async init() {
|
||||||
|
const result = await getApproveList()
|
||||||
|
this.setData({
|
||||||
|
list: result.data
|
||||||
|
})
|
||||||
|
},
|
||||||
|
async setAdmin(e) {
|
||||||
|
const { user } = e.currentTarget.dataset;
|
||||||
|
console.log('user', user)
|
||||||
|
await wxModal({ content: `你的管理员身份将转交给${user.nickName}` })
|
||||||
|
const { code, message } = await approveUser({ userId: user.id, type: 2 })
|
||||||
|
if (code !== OK) {
|
||||||
|
alertInfo(message)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
alertSuccess("转交成功")
|
||||||
|
wx.clearStorageSync()
|
||||||
|
wx.exitMiniProgram()
|
||||||
|
},
|
||||||
|
async disAgree(e) {
|
||||||
|
const { user } = e.currentTarget.dataset;
|
||||||
|
await wxModal({ content: `拒绝${user.nickName}的申请?` })
|
||||||
|
const { code, message } = await approveUser({ userId: user.id, type: 0 })
|
||||||
|
if (code !== OK) {
|
||||||
|
alertInfo(message)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
alertSuccess("已拒绝")
|
||||||
|
this.init()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
4
pages/member/components/memberManage/index.json
Normal file
4
pages/member/components/memberManage/index.json
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"component": true,
|
||||||
|
"usingComponents": {}
|
||||||
|
}
|
8
pages/member/components/memberManage/index.wxml
Normal file
8
pages/member/components/memberManage/index.wxml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<!--pages/member/components/memberManage/index.wxml-->
|
||||||
|
<view wx:for="{{list}}" wx:key="index" wx:for-item="item" class="item">
|
||||||
|
<view class="nickName"> {{ item.nickName }} </view>
|
||||||
|
<view class="operate">
|
||||||
|
<view class="primaryTextBtn" data-user="{{item}}" bind:tap="setAdmin"> 设为管理员 </view>
|
||||||
|
<view class="disAgree dangerTextBtn" data-user="{{item}}" bind:tap="remove"> 移除 </view>
|
||||||
|
</view>
|
||||||
|
</view>
|
21
pages/member/components/memberManage/index.wxss
Normal file
21
pages/member/components/memberManage/index.wxss
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
|
||||||
|
.item {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
padding-top: 24rpx;
|
||||||
|
padding-bottom: 24rpx;
|
||||||
|
margin-left: 32rpx;
|
||||||
|
margin-right: 32rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nickName {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.operate {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
.disAgree {
|
||||||
|
margin-left: 24rpx;
|
||||||
|
}
|
70
pages/member/index.js
Normal file
70
pages/member/index.js
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
// pages/member/index.js
|
||||||
|
Page({
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面的初始数据
|
||||||
|
*/
|
||||||
|
data: {
|
||||||
|
active: 0
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面加载
|
||||||
|
*/
|
||||||
|
onLoad(options) {
|
||||||
|
|
||||||
|
},
|
||||||
|
onChangeTab(e) {
|
||||||
|
this.setData({
|
||||||
|
active: e.detail.index
|
||||||
|
})
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面初次渲染完成
|
||||||
|
*/
|
||||||
|
onReady() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面显示
|
||||||
|
*/
|
||||||
|
onShow() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面隐藏
|
||||||
|
*/
|
||||||
|
onHide() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面卸载
|
||||||
|
*/
|
||||||
|
onUnload() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面相关事件处理函数--监听用户下拉动作
|
||||||
|
*/
|
||||||
|
onPullDownRefresh() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面上拉触底事件的处理函数
|
||||||
|
*/
|
||||||
|
onReachBottom() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户点击右上角分享
|
||||||
|
*/
|
||||||
|
onShareAppMessage() {
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
8
pages/member/index.json
Normal file
8
pages/member/index.json
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"usingComponents": {
|
||||||
|
"van-tab": "@vant/weapp/tab/index",
|
||||||
|
"van-tabs": "@vant/weapp/tabs/index",
|
||||||
|
"approve-member": "./components/approveMember/index",
|
||||||
|
"member-manage": "./components/memberManage/index"
|
||||||
|
}
|
||||||
|
}
|
9
pages/member/index.wxml
Normal file
9
pages/member/index.wxml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<!--pages/member/index.wxml-->
|
||||||
|
<van-tabs active="{{ active }}" bind:change="onChangeTab">
|
||||||
|
<van-tab title="申请人员">
|
||||||
|
<approve-member />
|
||||||
|
</van-tab>
|
||||||
|
<van-tab title="人员管理">
|
||||||
|
<member-manage />
|
||||||
|
</van-tab>
|
||||||
|
</van-tabs>
|
1
pages/member/index.wxss
Normal file
1
pages/member/index.wxss
Normal file
@ -0,0 +1 @@
|
|||||||
|
/* pages/member/index.wxss */
|
@ -1,3 +1,5 @@
|
|||||||
|
import { getMeterList } from "../../service/meter";
|
||||||
|
|
||||||
// pages/meterList/index.js
|
// pages/meterList/index.js
|
||||||
Page({
|
Page({
|
||||||
|
|
||||||
@ -5,11 +7,7 @@ Page({
|
|||||||
* 页面的初始数据
|
* 页面的初始数据
|
||||||
*/
|
*/
|
||||||
data: {
|
data: {
|
||||||
codes: [
|
list: [
|
||||||
{ code: "2331242324", money: 510 },
|
|
||||||
{ code: "4234234134", money: 10 },
|
|
||||||
{ code: "2354245345", money: 50 },
|
|
||||||
{ code: "5365457642", money: 150 },
|
|
||||||
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -18,9 +16,20 @@ Page({
|
|||||||
* 生命周期函数--监听页面加载
|
* 生命周期函数--监听页面加载
|
||||||
*/
|
*/
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
async getList() {
|
||||||
|
const { code, message, data = [] } = await getMeterList()
|
||||||
|
this.setData({
|
||||||
|
list: data
|
||||||
|
})
|
||||||
|
},
|
||||||
|
jumpToRecharge(e) {
|
||||||
|
const { code, tenement } = e.currentTarget.dataset;
|
||||||
|
wx.navigateTo({
|
||||||
|
url: `/pages/recharge/index?code=${code}&tenement=${tenement}`,
|
||||||
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生命周期函数--监听页面初次渲染完成
|
* 生命周期函数--监听页面初次渲染完成
|
||||||
*/
|
*/
|
||||||
|
@ -2,5 +2,6 @@
|
|||||||
"usingComponents": {
|
"usingComponents": {
|
||||||
"navigator": "/components/navigator/index",
|
"navigator": "/components/navigator/index",
|
||||||
"scrollPageWrapper": "/components/scrollPageWrapper/index"
|
"scrollPageWrapper": "/components/scrollPageWrapper/index"
|
||||||
}
|
},
|
||||||
|
"navigationBarTitleText": "表计列表"
|
||||||
}
|
}
|
@ -1,12 +1,24 @@
|
|||||||
<!--pages/meterList/index.wxml-->
|
<!--pages/meterList/index.wxml-->
|
||||||
<scrollPageWrapper>
|
<view class="wrapper">
|
||||||
<navigator title="表计列表" />
|
<view wx:for="{{list}}" wx:key="index" class="listItem">
|
||||||
|
<view class="tenementName"> {{ item.tenement.name }} :</view>
|
||||||
|
<view class="meter" wx:for="{{item.meter}}" wx:for-item="ele" wx:key="code">
|
||||||
<view class="content">
|
<view class="content">
|
||||||
<scroll-view type="list" scroll-y style="display: flex; flex-direction: column; flex: 1; width: 100%; overflow: auto;">
|
<view class="code"> 表{{ ele.code }}:余额为 </view>
|
||||||
<view wx:for="{{codes}}" list-item class="listItem">
|
<view class="money"> {{ ele.money }} </view>
|
||||||
<view class="code"> {{ item.code }} </view>
|
<view
|
||||||
<view class="money"> {{ item.money }} </view>
|
class="primaryTextBtn"
|
||||||
|
bind:tap="jumpToRecharge"
|
||||||
|
data-tenement="{{item.tenement.id}}"
|
||||||
|
data-code="{{ele.code}}"
|
||||||
|
> 充值 </view>
|
||||||
</view>
|
</view>
|
||||||
</scroll-view>
|
<view class="address">
|
||||||
|
表计地址: {{ ele.address }}
|
||||||
</view>
|
</view>
|
||||||
</scrollPageWrapper>
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,20 +1,40 @@
|
|||||||
/* pages/meterList/index.wxss */
|
/* pages/meterList/index.wxss */
|
||||||
.content {
|
/* .content {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
padding: 16rpx 24rpx 20rpx;
|
padding: 16rpx 24rpx 20rpx;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
display: flex;
|
display: flex;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
} */
|
||||||
|
|
||||||
.listItem {
|
.listItem {
|
||||||
display: flex;
|
/* display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between; */
|
||||||
margin: 12rpx 0;
|
margin: 12rpx 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.money {
|
.money {
|
||||||
font-size: 36rpx;
|
font-size: 36rpx;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
|
margin-left: 20rpx;
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
margin-left: 30rpx;
|
||||||
|
margin-right: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.address {
|
||||||
|
margin-left: 30rpx;
|
||||||
|
margin-right: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tenementName {
|
||||||
|
font-size: 42rpx;
|
||||||
|
font-weight: 600;
|
||||||
|
margin-bottom: 20rpx;
|
||||||
}
|
}
|
@ -26,6 +26,16 @@ Page({
|
|||||||
url: '/pages/questions/index',
|
url: '/pages/questions/index',
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
jumpToMember() {
|
||||||
|
wx.navigateTo({
|
||||||
|
url: '/pages/member/index',
|
||||||
|
})
|
||||||
|
},
|
||||||
|
jumpToQrCode() {
|
||||||
|
wx.navigateTo({
|
||||||
|
url: '/pages/qrCode/index',
|
||||||
|
})
|
||||||
|
},
|
||||||
/**
|
/**
|
||||||
* 生命周期函数--监听页面显示
|
* 生命周期函数--监听页面显示
|
||||||
*/
|
*/
|
||||||
|
@ -3,9 +3,10 @@
|
|||||||
<!-- <cell open-type="contact" title="联系客服" borderBottom="{{true}}" />
|
<!-- <cell open-type="contact" title="联系客服" borderBottom="{{true}}" />
|
||||||
<cell title="常见问题" bind:click="jumpToQuestions" /> -->
|
<cell title="常见问题" bind:click="jumpToQuestions" /> -->
|
||||||
|
|
||||||
<van-cell-group title=" ">
|
<!-- <van-cell-group title=" "> -->
|
||||||
|
<van-cell title="二维码" value="" is-link bind:click="jumpToQrCode" />
|
||||||
|
<van-cell title="成员管理" value="" is-link bind:click="jumpToMember" />
|
||||||
|
<!-- </van-cell-group> -->
|
||||||
|
<!-- <van-cell-group title=" ">
|
||||||
<van-cell title="单元格" value="内容" is-link />
|
<van-cell title="单元格" value="内容" is-link />
|
||||||
</van-cell-group>
|
</van-cell-group> -->
|
||||||
<van-cell-group title=" ">
|
|
||||||
<van-cell title="单元格" value="内容" is-link />
|
|
||||||
</van-cell-group>
|
|
66
pages/qrCode/index.js
Normal file
66
pages/qrCode/index.js
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
// pages/qrCode/index.js
|
||||||
|
Page({
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面的初始数据
|
||||||
|
*/
|
||||||
|
data: {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面加载
|
||||||
|
*/
|
||||||
|
onLoad(options) {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面初次渲染完成
|
||||||
|
*/
|
||||||
|
onReady() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面显示
|
||||||
|
*/
|
||||||
|
onShow() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面隐藏
|
||||||
|
*/
|
||||||
|
onHide() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面卸载
|
||||||
|
*/
|
||||||
|
onUnload() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面相关事件处理函数--监听用户下拉动作
|
||||||
|
*/
|
||||||
|
onPullDownRefresh() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面上拉触底事件的处理函数
|
||||||
|
*/
|
||||||
|
onReachBottom() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户点击右上角分享
|
||||||
|
*/
|
||||||
|
onShareAppMessage() {
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
3
pages/qrCode/index.json
Normal file
3
pages/qrCode/index.json
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"usingComponents": {}
|
||||||
|
}
|
5
pages/qrCode/index.wxml
Normal file
5
pages/qrCode/index.wxml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<!--pages/qrCode/index.wxml-->
|
||||||
|
<view class="wrapper">
|
||||||
|
<view class="text"> 扫码二维码,管理员同意后可进入 </view>
|
||||||
|
<van-icon name="qr" />
|
||||||
|
</view>
|
13
pages/qrCode/index.wxss
Normal file
13
pages/qrCode/index.wxss
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
/* pages/qrCode/index.wxss */
|
||||||
|
.wrapper {
|
||||||
|
width: 100vw;
|
||||||
|
height: 100vh;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.text {
|
||||||
|
text-align: center;
|
||||||
|
margin-bottom: 10vh;
|
||||||
|
}
|
@ -1,3 +1,4 @@
|
|||||||
|
import { getMeterDetail } from "../../service/meter";
|
||||||
import { getGlobalData, showModal } from "../../utils/index";
|
import { getGlobalData, showModal } from "../../utils/index";
|
||||||
|
|
||||||
// pages/recharge/index.js
|
// pages/recharge/index.js
|
||||||
@ -7,22 +8,29 @@ Page({
|
|||||||
* 页面的初始数据
|
* 页面的初始数据
|
||||||
*/
|
*/
|
||||||
data: {
|
data: {
|
||||||
code: "",
|
|
||||||
money: 0,
|
money: 0,
|
||||||
moneyIndex: -1,
|
moneyIndex: -1,
|
||||||
primaryColor: getGlobalData().primaryColor,
|
primaryColor: getGlobalData().primaryColor,
|
||||||
codes: ['105465640', '46845132', '1645468'],
|
|
||||||
defaultMoneyArray: [100, 200, 500, 1000, 2000],
|
defaultMoneyArray: [100, 200, 500, 1000, 2000],
|
||||||
customFlag: false,
|
customFlag: false,
|
||||||
|
detail: {}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生命周期函数--监听页面加载
|
* 生命周期函数--监听页面加载
|
||||||
*/
|
*/
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
|
const { tenement, code } = options
|
||||||
|
console.log('options', options)
|
||||||
|
this.init({ tenement, code })
|
||||||
|
},
|
||||||
|
async init(options) {
|
||||||
|
const { code, message, data = {}} = await getMeterDetail(options)
|
||||||
|
console.log('data', data)
|
||||||
|
this.setData({
|
||||||
|
detail: data
|
||||||
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生命周期函数--监听页面初次渲染完成
|
* 生命周期函数--监听页面初次渲染完成
|
||||||
*/
|
*/
|
||||||
@ -38,7 +46,6 @@ Page({
|
|||||||
},
|
},
|
||||||
chooseMoney(e) {
|
chooseMoney(e) {
|
||||||
const { money, index } = e.currentTarget.dataset;
|
const { money, index } = e.currentTarget.dataset;
|
||||||
console.log('index', index, typeof index)
|
|
||||||
this.setData({
|
this.setData({
|
||||||
money,
|
money,
|
||||||
moneyIndex: Number(index),
|
moneyIndex: Number(index),
|
||||||
@ -59,19 +66,17 @@ Page({
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
onChangeCustomMoney(e) {
|
onChangeCustomMoney(e) {
|
||||||
console.log('onChangeCustomMoney', e)
|
|
||||||
const money = e.detail.value;
|
const money = e.detail.value;
|
||||||
this.setData({
|
this.setData({
|
||||||
money: money,
|
money: money,
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
async recharge() {
|
async recharge() {
|
||||||
const { code, money } = this.data;
|
const { detail = {}, money } = this.data;
|
||||||
const confirmResult = await showModal({ title: "充值确认", content: `确认充值表号为${code}的表计${money}元吗?` });
|
const confirmResult = await showModal({ title: "充值确认", content: `确认充值表号为${detail?.meter?.code}的表计${money}元吗?` });
|
||||||
if (!confirmResult) {
|
if (!confirmResult) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
console.log('确认')
|
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* 生命周期函数--监听页面隐藏
|
* 生命周期函数--监听页面隐藏
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
{
|
{
|
||||||
"usingComponents": {
|
"usingComponents": {
|
||||||
"navigator": "/components/navigator/index"
|
"navigator": "/components/navigator/index",
|
||||||
}
|
"van-grid": "@vant/weapp/grid/index",
|
||||||
|
"van-grid-item": "@vant/weapp/grid-item/index",
|
||||||
|
"van-row": "@vant/weapp/row/index",
|
||||||
|
"van-col": "@vant/weapp/col/index"
|
||||||
|
},
|
||||||
|
"navigationBarTitleText": "充值"
|
||||||
}
|
}
|
@ -1,42 +1,76 @@
|
|||||||
<!--pages/recharge/index.wxml-->
|
<!--pages/recharge/index.wxml-->
|
||||||
<navigator title="充值" />
|
|
||||||
<view class="wrapper">
|
<view class="wrapper">
|
||||||
<!-- 账单周期 T13561356146548465815313 创新风华 -->
|
<!-- <van-grid column-num="2" center="{{false}}">
|
||||||
<view style="display: flex;align-items: center;font-size: 24rpx;">
|
<van-grid-item icon="photo-o" text="文字" use-slot>
|
||||||
<view style="margin-right: 20rpx;">
|
|
||||||
<view> 电费账单 </view>
|
|
||||||
<view> 2024年02月 </view>
|
|
||||||
</view>
|
|
||||||
<view style="flex: 1;display: flex;">
|
|
||||||
<view style="margin-right: 20rpx;">
|
|
||||||
<view>商户编号</view>
|
|
||||||
<view> T00062102047096834 </view> </view>
|
|
||||||
<view>
|
<view>
|
||||||
|
<view class="gridTitle"> 充值表号: </view>
|
||||||
|
<view class="gridContent"> {{ detail.meter.code }} </view>
|
||||||
|
</view>
|
||||||
|
</van-grid-item>
|
||||||
|
<van-grid-item icon="photo-o" text="文字" use-slot>
|
||||||
<view>
|
<view>
|
||||||
商户名称
|
<view class="gridTitle"> 表计地址: </view>
|
||||||
|
<view class="gridContent"> {{ detail.meter.address }} </view>
|
||||||
</view>
|
</view>
|
||||||
|
</van-grid-item>
|
||||||
|
<van-grid-item icon="photo-o" text="文字" use-slot>
|
||||||
<view>
|
<view>
|
||||||
创新风华</view>
|
<view class="gridTitle"> 剩余金额: </view>
|
||||||
</view>
|
<view class="gridContent"> {{ detail.money }} </view>
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<!-- <view class="chooseMeter">
|
|
||||||
充值表号
|
|
||||||
<view class="selectMeter">
|
|
||||||
<picker bindchange="onChangeCode" value="{{index}}" range="{{codes}}">
|
|
||||||
<view class="picker">
|
|
||||||
<view class="input border" wx:if="{{code}}">{{code}}</view>
|
|
||||||
<view class="input border" style="color: rgb(116, 109, 109)" wx:else>请选择</view>
|
|
||||||
</view>
|
|
||||||
</picker>
|
|
||||||
</view>
|
</view>
|
||||||
|
</van-grid-item>
|
||||||
|
<van-grid-item icon="photo-o" text="文字" use-slot>
|
||||||
|
<view>
|
||||||
|
<view class="gridTitle"> 公司名称: </view>
|
||||||
|
<view class="gridContent"> {{ detail.tenement.name }} </view>
|
||||||
</view>
|
</view>
|
||||||
|
</van-grid-item>
|
||||||
|
</van-grid> -->
|
||||||
|
<van-row gutter="10">
|
||||||
|
<van-col span="12">
|
||||||
|
<view class="title">充值表号:</view>
|
||||||
|
<view class="content">{{ detail.meter.code }}</view>
|
||||||
|
</van-col>
|
||||||
|
<van-col span="12">
|
||||||
|
<view class="title">表计地址:</view>
|
||||||
|
<view class="content">{{ detail.meter.address }}</view>
|
||||||
|
</van-col>
|
||||||
|
|
||||||
|
<van-col span="12" custom-class="colBottom">
|
||||||
|
<view class="title">剩余金额:</view>
|
||||||
|
<view class="content">{{ detail.money }}</view>
|
||||||
|
</van-col>
|
||||||
|
<van-col span="12" custom-class="colBottom">
|
||||||
|
<view class="title">公司名称:</view>
|
||||||
|
<view class="content">{{ detail.tenement.name }}</view>
|
||||||
|
</van-col>
|
||||||
|
|
||||||
|
</van-row>
|
||||||
<view class="moneyBoxs">
|
<view class="moneyBoxs">
|
||||||
<view wx:for="{{defaultMoneyArray}}" class="moneyBox border radius12" style="background-color: {{moneyIndex === index ? primaryColor : ''}};" bind:tap="chooseMoney" data-money="{{item}}" data-index="{{index}}"> {{item}} </view>
|
<view
|
||||||
|
wx:for="{{defaultMoneyArray}}"
|
||||||
|
class="moneyBox border radius12"
|
||||||
|
style="background-color: {{moneyIndex === index ? primaryColor : ''}};"
|
||||||
|
wx:key="index"
|
||||||
|
bind:tap="chooseMoney"
|
||||||
|
data-money="{{item}}"
|
||||||
|
data-index="{{index}}"
|
||||||
|
> {{item}} </view>
|
||||||
<view class="moneyBox border radius12" bind:tap="custom"> 自定义 </view>
|
<view class="moneyBox border radius12" bind:tap="custom"> 自定义 </view>
|
||||||
</view>
|
</view>
|
||||||
<view class="customInput border radius12" wx:if="{{customFlag}}" > <input type="number" focus placeholder="请输入要充值的金额" bindinput="onChangeCustomMoney"/> </view>
|
<view
|
||||||
|
class="customInput border radius12"
|
||||||
|
wx:if="{{customFlag}}"
|
||||||
|
>
|
||||||
|
<input
|
||||||
|
type="number"
|
||||||
|
focus
|
||||||
|
placeholder="请输入要充值的金额"
|
||||||
|
bindinput="onChangeCustomMoney"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
<view class="operate">
|
<view class="operate">
|
||||||
<button type="primary" bind:tap="recharge" disabled="{{!code || !money}}"> 充值 </button>
|
<button type="primary" bind:tap="recharge" disabled="{{!money}}"> 充值 </button>
|
||||||
</view> -->
|
</view>
|
||||||
</view>
|
</view>
|
@ -42,3 +42,21 @@
|
|||||||
.customInput {
|
.customInput {
|
||||||
padding: 16rpx 24rpx;
|
padding: 16rpx 24rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.gridTitle {
|
||||||
|
margin-bottom: 24rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.colBottom {
|
||||||
|
margin-top: 40rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.title {
|
||||||
|
font-weight: 600;
|
||||||
|
font-size: 40rpx;
|
||||||
|
margin-bottom: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content {
|
||||||
|
font-size: 32rpx;
|
||||||
|
}
|
@ -1,3 +1,4 @@
|
|||||||
|
import { getRechargeList } from "../../service/recharge";
|
||||||
import { getYears } from "../../utils/index";
|
import { getYears } from "../../utils/index";
|
||||||
|
|
||||||
// pages/rechargeRecord/index.js
|
// pages/rechargeRecord/index.js
|
||||||
@ -11,22 +12,7 @@ Page({
|
|||||||
month: new Date().getMonth() + 1,
|
month: new Date().getMonth() + 1,
|
||||||
years: getYears(),
|
years: getYears(),
|
||||||
list: [
|
list: [
|
||||||
{ code: '165146513', money: 100, time: "2024-02-20 18:56:15" },
|
|
||||||
{ code: '466541651', money: 200, time: "2024-02-28 18:56:15" },
|
|
||||||
{ code: '165146513', money: 100, time: "2024-02-20 18:56:15" },
|
|
||||||
{ code: '466541651', money: 200, time: "2024-02-28 18:56:15" },
|
|
||||||
{ code: '165146513', money: 100, time: "2024-02-20 18:56:15" },
|
|
||||||
{ code: '466541651', money: 200, time: "2024-02-28 18:56:15" },
|
|
||||||
{ code: '165146513', money: 100, time: "2024-02-20 18:56:15" },
|
|
||||||
{ code: '466541651', money: 200, time: "2024-02-28 18:56:15" },
|
|
||||||
{ code: '165146513', money: 100, time: "2024-02-20 18:56:15" },
|
|
||||||
{ code: '466541651', money: 200, time: "2024-02-28 18:56:15" },
|
|
||||||
{ code: '165146513', money: 100, time: "2024-02-20 18:56:15" },
|
|
||||||
{ code: '466541651', money: 200, time: "2024-02-28 18:56:15" },
|
|
||||||
{ code: '165146513', money: 100, time: "2024-02-20 18:56:15" },
|
|
||||||
{ code: '466541651', money: 200, time: "2024-02-28 18:56:15" },
|
|
||||||
{ code: '165146513', money: 100, time: "2024-02-20 18:56:15" },
|
|
||||||
{ code: '466541651', money: 200, time: "2024-02-28 18:56:15" }
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -45,17 +31,26 @@ Page({
|
|||||||
},
|
},
|
||||||
onChangeYear(e) {
|
onChangeYear(e) {
|
||||||
const { years } = this.data;
|
const { years } = this.data;
|
||||||
|
const currentYear = years[Number(e.detail.value)]
|
||||||
this.setData({
|
this.setData({
|
||||||
year: years[Number(e.detail.value)]
|
year: currentYear
|
||||||
})
|
})
|
||||||
|
this.init(currentYear)
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* 生命周期函数--监听页面显示
|
* 生命周期函数--监听页面显示
|
||||||
*/
|
*/
|
||||||
onShow() {
|
onShow() {
|
||||||
|
const currentYear = this.data.year;
|
||||||
|
this.init(currentYear)
|
||||||
|
},
|
||||||
|
async init(year) {
|
||||||
|
const { code, message, data } = await getRechargeList(year);
|
||||||
|
console.log('data', data)
|
||||||
|
this.setData({
|
||||||
|
list: data
|
||||||
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生命周期函数--监听页面隐藏
|
* 生命周期函数--监听页面隐藏
|
||||||
*/
|
*/
|
||||||
|
@ -2,5 +2,6 @@
|
|||||||
"usingComponents": {
|
"usingComponents": {
|
||||||
"navigator": "/components/navigator/index",
|
"navigator": "/components/navigator/index",
|
||||||
"scrollPageWrapper": "/components/scrollPageWrapper/index"
|
"scrollPageWrapper": "/components/scrollPageWrapper/index"
|
||||||
}
|
},
|
||||||
|
"navigationBarTitleText": "充值记录"
|
||||||
}
|
}
|
@ -1,8 +1,5 @@
|
|||||||
<!--pages/rechargeRecord/index.wxml-->
|
<!--pages/rechargeRecord/index.wxml-->
|
||||||
<scrollPageWrapper>
|
<view class="wrapper" list-item>
|
||||||
<navigator title="充值记录" />
|
|
||||||
<scroll-view type="list" scroll-y style="display: flex; flex-direction: column; flex: 1; width: 100%; overflow: auto;">
|
|
||||||
<view class="wrapper" list-item>
|
|
||||||
<view>
|
<view>
|
||||||
<picker bindchange="onChangeYear" value="{{index}}" range="{{years}}">
|
<picker bindchange="onChangeYear" value="{{index}}" range="{{years}}">
|
||||||
<view class="yearPicker">
|
<view class="yearPicker">
|
||||||
@ -12,14 +9,12 @@
|
|||||||
</picker>
|
</picker>
|
||||||
</view>
|
</view>
|
||||||
<view class="recordsWrapper">
|
<view class="recordsWrapper">
|
||||||
<view class="recordsItem border" wx:for="{{list}}">
|
<view class="recordsItem border" wx:for="{{list}}" wx:key="index">
|
||||||
<view class="codeTime">
|
<view class="codeTime">
|
||||||
<view class="code"> 表号:{{ item.code }} </view>
|
<view class="code"> 表号:{{ item.meter.code }} </view>
|
||||||
<view class="time"> {{ item.time }} </view>
|
<view class="time"> {{ item.time }} </view>
|
||||||
</view>
|
</view>
|
||||||
<view class="money"> {{ item.money }} </view>
|
<view class="money"> {{ item.money }} </view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</scroll-view>
|
|
||||||
</scrollPageWrapper>
|
|
||||||
|
@ -7,6 +7,6 @@ export const getMeterList = async function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 获取表计详情
|
// 获取表计详情
|
||||||
export const getMeterDetail = async function() {
|
export const getMeterDetail = async function({ tenement, code }) {
|
||||||
return await GET(`/wx/getMeterDetail/${tenement}/${code}`);
|
return await GET(`/wx/getMeterDetail/${tenement}/${code}`);
|
||||||
}
|
}
|
@ -2,6 +2,6 @@ import apis from '../utils/request';
|
|||||||
const { GET, POST, PUT, DELETE } = apis
|
const { GET, POST, PUT, DELETE } = apis
|
||||||
|
|
||||||
// 获取园区列表
|
// 获取园区列表
|
||||||
export const getParkList = async function() {
|
export const getParkList = async function({ keyword }) {
|
||||||
return await GET(`/wx/getParkList`);
|
return await GET(`/wx/getParkList?keyword=${keyword}`);
|
||||||
}
|
}
|
@ -2,6 +2,6 @@ import apis from '../utils/request';
|
|||||||
const { GET, POST, PUT, DELETE } = apis
|
const { GET, POST, PUT, DELETE } = apis
|
||||||
|
|
||||||
// 获取园区id模糊搜索商户列表
|
// 获取园区id模糊搜索商户列表
|
||||||
export const getParkList = async function({ park, keyword }) {
|
export const getTenementList = async function({ park, keyword }) {
|
||||||
return await GET(`/wx/getTenementList?park=${park}&keyword=${keyword}`);
|
return await GET(`/wx/getTenementList?park=${park}&keyword=${keyword}`);
|
||||||
}
|
}
|
@ -43,7 +43,8 @@ export function getConfigByEnv() {
|
|||||||
switch (envVersion) {
|
switch (envVersion) {
|
||||||
// 开发版
|
// 开发版
|
||||||
case 'develop':
|
case 'develop':
|
||||||
api = "http://localhost:8000"
|
// api = "http://localhost:8000"
|
||||||
|
api = "http://127.0.0.1:4523/m1/4143821-0-default"
|
||||||
break;
|
break;
|
||||||
// 体验版
|
// 体验版
|
||||||
case 'trial':
|
case 'trial':
|
||||||
@ -196,3 +197,20 @@ export const wxLogin = () => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const wxModal = (data) => {
|
||||||
|
const { title = '提示', content } = data;
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
wx.showModal({
|
||||||
|
title,
|
||||||
|
content,
|
||||||
|
success (res) {
|
||||||
|
if (res.confirm) {
|
||||||
|
resolve()
|
||||||
|
} else if (res.cancel) {
|
||||||
|
reject()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
@ -85,19 +85,18 @@ const parseResponse = function (response) {
|
|||||||
wx.redirectTo({
|
wx.redirectTo({
|
||||||
url: '/pages/login/index',
|
url: '/pages/login/index',
|
||||||
})
|
})
|
||||||
return { code: 1, message: '未登录状态' }
|
return { code: 401, message: '未登录状态' }
|
||||||
}
|
}
|
||||||
if (statusCode === 404) {
|
if (statusCode === 404) {
|
||||||
return { code: 1, message: "服务故障" }
|
return { code: 404, message: "服务故障" }
|
||||||
}
|
}
|
||||||
if (500 <= statusCode < 600) {
|
if (500 <= statusCode && statusCode < 600) {
|
||||||
return { code: 1, message: "服务错误" }
|
return { code: 500, message: "服务错误" }
|
||||||
}
|
}
|
||||||
|
|
||||||
if (response.data.code !== 0) {
|
if (response.data.code !== 200) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return response.data;
|
return response.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user