拉代码
This commit is contained in:
commit
6e2608925c
13
app.json
13
app.json
|
@ -14,11 +14,14 @@
|
|||
"pages/waitApprove/index",
|
||||
"pages/apply/index",
|
||||
"pages/qrCode/index",
|
||||
"pages/recharge/index",
|
||||
"pages/questions/index",
|
||||
"pages/rechargeDetail/index",
|
||||
"pages/updateInvoice/index",
|
||||
"pages/rechargeWay/index"
|
||||
"pages/rechargeWay/index",
|
||||
"pages/publicTransfer/index",
|
||||
"pages/special/index",
|
||||
"pages/encyclopedia/index",
|
||||
"pages/encyclopediaDetail/index"
|
||||
],
|
||||
"subPackages": [
|
||||
{
|
||||
|
@ -38,6 +41,12 @@
|
|||
"iconPath": "/assets/tabbar/home.png",
|
||||
"selectedIconPath": "/assets/tabbar/home_select.png"
|
||||
},
|
||||
{
|
||||
"pagePath": "pages/special/index",
|
||||
"text": "专区",
|
||||
"iconPath": "/assets/tabbar/special.png",
|
||||
"selectedIconPath": "/assets/tabbar/special_select.png"
|
||||
},
|
||||
{
|
||||
"pagePath": "pages/my/index",
|
||||
"text": "我的",
|
||||
|
|
BIN
assets/tabbar/special.png
Normal file
BIN
assets/tabbar/special.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 10 KiB |
BIN
assets/tabbar/special_select.png
Normal file
BIN
assets/tabbar/special_select.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 10 KiB |
|
@ -39,13 +39,17 @@ Page({
|
|||
this.init(id, time);
|
||||
},
|
||||
async init(id, time) {
|
||||
const { code, message, detail } = await getReportDetail(id)
|
||||
const { code, message, detail, amount } = await getReportDetail(id)
|
||||
if (code !== OK) {
|
||||
alertInfo(message)
|
||||
return;
|
||||
}
|
||||
this.setData({
|
||||
id, time, detail, meters: detail?.meters?.map(item => {
|
||||
id,
|
||||
time,
|
||||
detail,
|
||||
amount: amount,
|
||||
meters: detail?.meters?.map(item => {
|
||||
const finalAmount = Number(item?.overall?.amount || 0) + Number(item?.loss?.amount || 0) + Number(item?.publicAmount || 0)
|
||||
item.finalAmount = Number(finalAmount).toFixed(2)
|
||||
return item;
|
||||
|
@ -77,8 +81,8 @@ Page({
|
|||
type: 'pie',
|
||||
radius: '50%',
|
||||
data: [
|
||||
{ value: 18.3, name: '本期线损电量', itemStyle: { color: 'rgb(104,187,196)' } },
|
||||
{ value: 187.56, name: '本期用电量', itemStyle: { color: 'rgb(80,135,236)' } },
|
||||
{ value: detail.comprehensive.lossAmount, name: '本期线损电量', itemStyle: { color: 'rgb(104,187,196)' } },
|
||||
{ value: detail.comprehensive.consumption, name: '本期用电量', itemStyle: { color: 'rgb(80,135,236)' } },
|
||||
|
||||
],
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
<van-col span="8">
|
||||
<view class="colContent">
|
||||
<view class="colContentTitle">本期用电量</view>
|
||||
<view class="colContentValue"> {{ detail.comprehensive.consumption }} 千瓦时 </view>
|
||||
<view class="colContentValue"> {{ amount }} 千瓦时 </view>
|
||||
</view>
|
||||
</van-col>
|
||||
<van-col span="8">
|
||||
|
|
|
@ -14,4 +14,3 @@
|
|||
</view>
|
||||
</view>
|
||||
</view>
|
||||
{{totalPage}}
|
||||
|
|
58
pages/encyclopedia/components/item/index.js
Normal file
58
pages/encyclopedia/components/item/index.js
Normal file
|
@ -0,0 +1,58 @@
|
|||
import { getEncyclopediaList } from "../../../../service/system";
|
||||
import { alertInfo, alertSuccess, loadingFunc, wxLogin } from "../../../../utils/index";
|
||||
import request from "../../../../utils/request"
|
||||
const { OK } = request;
|
||||
// pages/encyclopedia/components/item/index.js
|
||||
Component({
|
||||
|
||||
/**
|
||||
* 组件的属性列表
|
||||
*/
|
||||
properties: {
|
||||
id: String
|
||||
},
|
||||
|
||||
/**
|
||||
* 组件的初始数据
|
||||
*/
|
||||
data: {
|
||||
page: 1,
|
||||
list: [],
|
||||
},
|
||||
lifetimes: {
|
||||
attached() {
|
||||
console.log('----------=========')
|
||||
this.getData();
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 组件的方法列表
|
||||
*/
|
||||
methods: {
|
||||
async getData() {
|
||||
const page = this.data.page;
|
||||
const id = this.id;
|
||||
const { code, data, message, total } = await getEncyclopediaList(id, page);
|
||||
if (code !== OK) {
|
||||
alertInfo(message)
|
||||
return;
|
||||
}
|
||||
this.setData({ list: data, totalPage: Math.ceil(total / 20) });
|
||||
},
|
||||
jumpToDetail(e) {
|
||||
console.log('e', e)
|
||||
wx.navigateTo({
|
||||
url: `/pages/encyclopediaDetail/index?id=${e.currentTarget.dataset.data.id}`,
|
||||
})
|
||||
},
|
||||
async onChangePage(e) {
|
||||
const page = e.detail.currentIndex;
|
||||
const that = this;
|
||||
this.setData({
|
||||
page
|
||||
}, () => {
|
||||
that.getData();
|
||||
})
|
||||
},
|
||||
}
|
||||
})
|
10
pages/encyclopedia/components/item/index.json
Normal file
10
pages/encyclopedia/components/item/index.json
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"pagination": "/components/pagination/index",
|
||||
"navigator": "/components/navigator/index",
|
||||
"van-field": "@vant/weapp/field/index",
|
||||
"empty": "/components/empty/index"
|
||||
},
|
||||
"navigationStyle": "custom"
|
||||
}
|
21
pages/encyclopedia/components/item/index.wxml
Normal file
21
pages/encyclopedia/components/item/index.wxml
Normal file
|
@ -0,0 +1,21 @@
|
|||
<!--pages/encyclopedia/components/item/index.wxml-->
|
||||
<view wx:if="{{list.length}}">
|
||||
<van-field
|
||||
wx:for="{{list}}"
|
||||
value="{{ item.title }}"
|
||||
readonly
|
||||
border="{{ true }}"
|
||||
wx:key="id"
|
||||
bind:tap="jumpToDetail"
|
||||
data-data="{{item}}"
|
||||
/>
|
||||
<pagination
|
||||
currentIndex="{{page}}"
|
||||
totalPage="{{totalPage}}"
|
||||
bind:pagingChange="onChangePage"
|
||||
/>
|
||||
</view>
|
||||
|
||||
<view wx:else>
|
||||
<empty bind:refresh="getData" />
|
||||
</view>
|
1
pages/encyclopedia/components/item/index.wxss
Normal file
1
pages/encyclopedia/components/item/index.wxss
Normal file
|
@ -0,0 +1 @@
|
|||
/* pages/encyclopedia/components/item/index.wxss */
|
87
pages/encyclopedia/index.js
Normal file
87
pages/encyclopedia/index.js
Normal file
|
@ -0,0 +1,87 @@
|
|||
// pages/encyclopedia/index.js
|
||||
import { getCategoryList } from '../../service/system'
|
||||
import { alertInfo, alertSuccess, loadingFunc, wxLogin } from "../../utils/index";
|
||||
import request from "../../utils/request"
|
||||
const { OK } = request;
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
categoryList: [],
|
||||
active: 0,
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
this.init();
|
||||
},
|
||||
|
||||
async init() {
|
||||
const { data, code, message } = await getCategoryList();
|
||||
if (code !== OK) {
|
||||
alertInfo(message);
|
||||
return
|
||||
}
|
||||
this.setData({
|
||||
categoryList: data
|
||||
})
|
||||
},
|
||||
onChange(e) {
|
||||
console.log('e', e)
|
||||
this.setData({
|
||||
active: e.detail.index,
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage() {
|
||||
|
||||
}
|
||||
})
|
9
pages/encyclopedia/index.json
Normal file
9
pages/encyclopedia/index.json
Normal file
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"usingComponents": {
|
||||
"navigator": "/components/navigator/index",
|
||||
"van-tab": "@vant/weapp/tab/index",
|
||||
"van-tabs": "@vant/weapp/tabs/index",
|
||||
"item": "./components/item/index"
|
||||
},
|
||||
"navigationStyle": "custom"
|
||||
}
|
7
pages/encyclopedia/index.wxml
Normal file
7
pages/encyclopedia/index.wxml
Normal file
|
@ -0,0 +1,7 @@
|
|||
<!--pages/encyclopedia/index.wxml-->
|
||||
<navigator title="电力百科" canBack="{{true}}" />
|
||||
<van-tabs active="{{ active }}" bind:change="onChange" swipeable>
|
||||
<van-tab wx:for="{{categoryList}}" wx:key="id" title="{{item.name}}">
|
||||
<item id="{{item.id}}" wx:if="{{index === active}}" />
|
||||
</van-tab>
|
||||
</van-tabs>
|
1
pages/encyclopedia/index.wxss
Normal file
1
pages/encyclopedia/index.wxss
Normal file
|
@ -0,0 +1 @@
|
|||
/* pages/encyclopedia/index.wxss */
|
77
pages/encyclopediaDetail/index.js
Normal file
77
pages/encyclopediaDetail/index.js
Normal file
|
@ -0,0 +1,77 @@
|
|||
// pages/encyclopediaDetail/index.js
|
||||
import { getEncyclopediaDetail } from "../../service/system";
|
||||
import { alertInfo, alertSuccess, loadingFunc, wxLogin } from "../../utils/index";
|
||||
import request from "../../utils/request"
|
||||
const { OK } = request;
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
detail: {},
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
this.init(options.id)
|
||||
},
|
||||
async init(id) {
|
||||
const { code, data, message } = await getEncyclopediaDetail(id);
|
||||
if (code !== OK) {
|
||||
alertInfo(message)
|
||||
return;
|
||||
}
|
||||
this.setData({ detail: data });
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage() {
|
||||
|
||||
}
|
||||
})
|
6
pages/encyclopediaDetail/index.json
Normal file
6
pages/encyclopediaDetail/index.json
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"usingComponents": {
|
||||
"navigator": "/components/navigator/index"
|
||||
},
|
||||
"navigationStyle": "custom"
|
||||
}
|
6
pages/encyclopediaDetail/index.wxml
Normal file
6
pages/encyclopediaDetail/index.wxml
Normal file
|
@ -0,0 +1,6 @@
|
|||
<!--pages/encyclopediaDetail/index.wxml-->
|
||||
<navigator title="百科详情" canBack="{{true}}" />
|
||||
<view class="contentWrapper">
|
||||
<view class="title">{{detail.title}}</view>
|
||||
<view class="content">{{detail.content}}</view>
|
||||
</view>
|
14
pages/encyclopediaDetail/index.wxss
Normal file
14
pages/encyclopediaDetail/index.wxss
Normal file
|
@ -0,0 +1,14 @@
|
|||
/* pages/encyclopediaDetail/index.wxss */
|
||||
.contentWrapper {
|
||||
padding: 30rpx
|
||||
}
|
||||
.title {
|
||||
margin-top: 12rpx;
|
||||
font-weight: 600;
|
||||
font-size: 48rpx;
|
||||
}
|
||||
|
||||
.content {
|
||||
margin-top: 40rpx;
|
||||
|
||||
}
|
|
@ -22,11 +22,7 @@ Page({
|
|||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
const { canBack } = options
|
||||
console.log('cnaback', canBack)
|
||||
if (canBack === 'false') {
|
||||
this.setData({ canBack: false })
|
||||
}
|
||||
|
||||
},
|
||||
onChangeName(e) {
|
||||
this.setData({
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<!--pages/handleLogin/index.wxml-->
|
||||
<!-- <topbar /> -->
|
||||
<navigator title="绑定商户" canBack="{{canBack}}" />
|
||||
<navigator title="绑定商户" canBack="{{true}}" />
|
||||
<van-tabs>
|
||||
<van-tab title="扫码绑定">
|
||||
<view class="codeContent">
|
||||
|
|
|
@ -25,7 +25,7 @@ Page({
|
|||
rechargeVisible: false,
|
||||
actions: [
|
||||
{ name: '微信支付', },
|
||||
{ name: '对公支付', disabled: true },
|
||||
{ name: '对公支付' },
|
||||
],
|
||||
},
|
||||
|
||||
|
@ -269,9 +269,11 @@ Page({
|
|||
}
|
||||
if (!data?.length) {
|
||||
alertInfo("尚无信息")
|
||||
|
||||
setTimeout(() => {
|
||||
wx.clearStorageSync()
|
||||
wx.redirectTo({
|
||||
url: '/pages/handleLogin/index?back=false',
|
||||
url: '/pages/login/index',
|
||||
})
|
||||
}, 500)
|
||||
return;
|
||||
|
@ -326,7 +328,10 @@ Page({
|
|||
onSelectRechargeWay(e) {
|
||||
switch(e.detail.name) {
|
||||
case "对公支付":
|
||||
alertInfo("开发中")
|
||||
const { user, money, meter, tenement, park } = this.data;
|
||||
wx.navigateTo({
|
||||
url: `/pages/publicTransfer/index?money=${money}&meterId=${meter.id}&tenementId=${tenement.id}&tenementName=${tenement.name}&park=${park.id}`,
|
||||
})
|
||||
break;
|
||||
default:
|
||||
this.wxRecharge();
|
||||
|
|
138
pages/publicTransfer/index.js
Normal file
138
pages/publicTransfer/index.js
Normal file
|
@ -0,0 +1,138 @@
|
|||
// pages/publicTransfer/index.js
|
||||
import { getMeterDetail, getMeterList, getTenementMeterList } from "../../service/meter";
|
||||
import { createPublicTopUp } from '../../service/recharge'
|
||||
import { uploadFile, uploadPublicFile } from "../../service/public";
|
||||
import { alertInfo, loadingFunc, getFileName, alertSuccess } from "../../utils/index";
|
||||
import request from '../../utils/request';
|
||||
|
||||
const { OK } = request;
|
||||
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
const { money, meterId, tenementId, tenementName, park } = options;
|
||||
this.init({ money, meterId, tenementId, tenementName, park });
|
||||
},
|
||||
async init({ money, meterId, tenementId, tenementName, park }) {
|
||||
const { code, message, data } = await getMeterDetail({ tenement: tenementId, id: meterId });
|
||||
if (code !== OK) {
|
||||
alertInfo(message);
|
||||
return;
|
||||
}
|
||||
this.setData({
|
||||
meter: data,
|
||||
money,
|
||||
tenementName,
|
||||
tenementId,
|
||||
park
|
||||
})
|
||||
},
|
||||
async upload(res) {
|
||||
const result = await uploadPublicFile(res.tempFiles[0]?.tempFilePath)
|
||||
if (result.statusCode !== 200) {
|
||||
alertInfo("上传失败")
|
||||
return;
|
||||
}
|
||||
const data = JSON.parse(result.data)
|
||||
this.setData({
|
||||
fileList: [{ url: data.data, name: getFileName(data.data) }]
|
||||
})
|
||||
},
|
||||
onUpload() {
|
||||
wx.chooseMedia({
|
||||
count: 1, // 可以选择文件的数量
|
||||
mediaType: ['image'], // 可以选择文件的类型,这里只允许上传文件
|
||||
sourceType: ['album', 'camera'],
|
||||
success: (res) => {
|
||||
loadingFunc(async () => {
|
||||
await this.upload(res)
|
||||
})
|
||||
}
|
||||
});
|
||||
},
|
||||
async handleSubmit() {
|
||||
const { fileList, meter, money, park, tenementId } = this.data;
|
||||
if (!fileList?.length) {
|
||||
alertInfo("请上传凭证")
|
||||
return;
|
||||
}
|
||||
const { code, message } = await createPublicTopUp({
|
||||
id: meter.id,
|
||||
tenement: tenementId,
|
||||
money: Number(money),
|
||||
park,
|
||||
vouch: fileList[0].url
|
||||
})
|
||||
if (code !== OK) {
|
||||
alertInfo(message)
|
||||
return;
|
||||
}
|
||||
alertSuccess("已提交,待审核")
|
||||
setTimeout(() => {
|
||||
wx.redirectTo({
|
||||
url: '/pages/home/index',
|
||||
})
|
||||
}, 600)
|
||||
},
|
||||
handleDelete() {
|
||||
this.setData({ fileList: [] })
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage() {
|
||||
|
||||
}
|
||||
})
|
9
pages/publicTransfer/index.json
Normal file
9
pages/publicTransfer/index.json
Normal file
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"usingComponents": {
|
||||
"navigator": "/components/navigator/index",
|
||||
"van-field": "@vant/weapp/field/index",
|
||||
"van-uploader": "@vant/weapp/uploader/index",
|
||||
"van-button": "@vant/weapp/button/index"
|
||||
},
|
||||
"navigationStyle": "custom"
|
||||
}
|
25
pages/publicTransfer/index.wxml
Normal file
25
pages/publicTransfer/index.wxml
Normal file
|
@ -0,0 +1,25 @@
|
|||
<!--pages/publicTransfer/index.wxml-->
|
||||
<navigator title="对公转账" canBack="{{true}}" />
|
||||
<van-cell-group>
|
||||
<van-field label="用户名称" value="{{ tenementName }}" border="{{ false }}" readonly />
|
||||
<van-field label="电表编号" value="{{ meter.code }}" border="{{ false }}" readonly />
|
||||
<van-field label="电表地址" value="{{ meter.address }}" border="{{ false }}" readonly />
|
||||
<van-field label="付款方式" value="{{ '对公支付' }}" border="{{ false }}" readonly />
|
||||
<van-field label="付款金额" value="{{ money }}" border="{{ false }}" readonly />
|
||||
<van-field label="充值凭证" border="{{ false }}" use-input-slot type="textarea">
|
||||
<van-button slot="input" size="small" type="info" bind:tap="onUpload">
|
||||
点击上传
|
||||
</van-button>
|
||||
</van-field>
|
||||
</van-cell-group>
|
||||
|
||||
<view style="padding: 20rpx;">
|
||||
<van-uploader
|
||||
file-list="{{ fileList }}"
|
||||
show-upload="{{false}}"
|
||||
bind:delete="handleDelete"
|
||||
preview-size="220rpx"
|
||||
/>
|
||||
|
||||
<van-button bind:tap="handleSubmit" type="info" block style="margin-top: 20rpx;"> 提交 </van-button>
|
||||
</view>
|
1
pages/publicTransfer/index.wxss
Normal file
1
pages/publicTransfer/index.wxss
Normal file
|
@ -0,0 +1 @@
|
|||
/* pages/publicTransfer/index.wxss */
|
|
@ -1,113 +0,0 @@
|
|||
import { getMeterDetail } from "../../service/meter";
|
||||
import { getGlobalData, showModal } from "../../utils/index";
|
||||
|
||||
// pages/recharge/index.js
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
money: 0,
|
||||
moneyIndex: -1,
|
||||
primaryColor: getGlobalData().primaryColor,
|
||||
defaultMoneyArray: [100, 200, 500, 1000, 2000],
|
||||
customFlag: false,
|
||||
detail: {}
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
const { tenement, code } = options
|
||||
this.init({ tenement, code })
|
||||
},
|
||||
async init(options) {
|
||||
const { code, message, data = {}} = await getMeterDetail(options)
|
||||
this.setData({
|
||||
detail: data
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
|
||||
},
|
||||
chooseMoney(e) {
|
||||
const { money, index } = e.currentTarget.dataset;
|
||||
this.setData({
|
||||
money,
|
||||
moneyIndex: Number(index),
|
||||
customFlag: false,
|
||||
});
|
||||
},
|
||||
onChangeCode(e) {
|
||||
const { codes } = this.data;
|
||||
const index = Number(e.detail.value);
|
||||
this.setData({
|
||||
code: codes[index]
|
||||
})
|
||||
},
|
||||
custom() {
|
||||
this.setData({
|
||||
moneyIndex: -1,
|
||||
customFlag: true,
|
||||
})
|
||||
},
|
||||
onChangeCustomMoney(e) {
|
||||
const money = e.detail.value;
|
||||
this.setData({
|
||||
money: money,
|
||||
})
|
||||
},
|
||||
async recharge() {
|
||||
const { detail = {}, money } = this.data;
|
||||
const confirmResult = await showModal({ title: "充值确认", content: `确认充值表号为${detail?.meter?.code}的表计${money}元吗?` });
|
||||
if (!confirmResult) {
|
||||
return;
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage() {
|
||||
|
||||
}
|
||||
})
|
|
@ -1,10 +0,0 @@
|
|||
{
|
||||
"usingComponents": {
|
||||
"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,51 +0,0 @@
|
|||
<!--pages/recharge/index.wxml-->
|
||||
|
||||
<view class="wrapper">
|
||||
|
||||
<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
|
||||
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>
|
||||
<view
|
||||
class="customInput border radius12"
|
||||
wx:if="{{customFlag}}"
|
||||
>
|
||||
<input
|
||||
type="number"
|
||||
focus
|
||||
placeholder="请输入要充值的金额"
|
||||
bindinput="onChangeCustomMoney"
|
||||
/>
|
||||
</view>
|
||||
<view class="operate">
|
||||
<button type="primary" bind:tap="recharge" disabled="{{!money}}"> 充值 </button>
|
||||
</view>
|
||||
</view>
|
|
@ -1,62 +0,0 @@
|
|||
/* pages/recharge/index.wxss */
|
||||
.moneyBoxs {
|
||||
margin-top: 32rpx;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.moneyBox {
|
||||
width: 30%;
|
||||
height: 140rpx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
margin-bottom: 24rpx;
|
||||
}
|
||||
|
||||
.chooseMeter {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-top: 10rpx;
|
||||
}
|
||||
|
||||
.selectMeter {
|
||||
margin-left: 24rpx;
|
||||
}
|
||||
|
||||
.operate {
|
||||
margin-top: 24rpx;
|
||||
}
|
||||
|
||||
.input {
|
||||
height: 40rpx;
|
||||
width: 400rpx;
|
||||
line-height: 40rpx;
|
||||
border-radius: 20rpx;
|
||||
padding: 12rpx 14rpx 16rpx;
|
||||
/* border: 1rpx solid #ccc; */
|
||||
}
|
||||
|
||||
.customInput {
|
||||
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;
|
||||
}
|
|
@ -33,43 +33,59 @@ Page({
|
|||
})
|
||||
},
|
||||
record() {
|
||||
const handleDownload = () => {
|
||||
return new Promise((resolve, rej) => {
|
||||
const { detail } = this.data;
|
||||
wx.showModal({
|
||||
title: '提示',
|
||||
content: '为了您更好的体验,请复制链接,通过电脑浏览器打开下载',
|
||||
showCancel: true,
|
||||
cancelText: '关闭',
|
||||
confirmText: '复制链接',
|
||||
|
||||
complete: (res) => {
|
||||
if (res.confirm) {
|
||||
const result = wx.getAccountInfoSync();
|
||||
const { envVersion } = result.miniProgram;
|
||||
let api = ""
|
||||
switch (envVersion) {
|
||||
// 开发版
|
||||
case 'develop':
|
||||
wx.setClipboardData({
|
||||
data: `http://1.92.72.5:8080/recharge-print/?id=${detail.id}`,
|
||||
})
|
||||
// api = `http://localhost:9001`;
|
||||
api = `https://zgd.hbhcbn.com/recharge-print-api-test`;
|
||||
// api = `https://zgd.hbhcbn.com/recharge-print-api-test`;
|
||||
break;
|
||||
// 体验版
|
||||
case 'trial':
|
||||
wx.setClipboardData({
|
||||
data: `http://1.92.72.5:8080/recharge-print/?id=${detail.id}`,
|
||||
})
|
||||
api = `https://zgd.hbhcbn.com/recharge-print-api-test`;
|
||||
break;
|
||||
// 正式版
|
||||
case 'release':
|
||||
wx.setClipboardData({
|
||||
data: `https://zgd.hbhcbn.com/recharge-print/?id=${detail.id}`,
|
||||
})
|
||||
api = `https://zgd.hbhcbn.com/recharge-print-api`;
|
||||
break;
|
||||
}
|
||||
|
||||
console.log("api", `${api}/${detail.id}`)
|
||||
wx.downloadFile({
|
||||
url: `${api}/${detail.id}`,
|
||||
success: (res) => {
|
||||
console.log('res', res)
|
||||
if (res.statusCode === 200) {
|
||||
if (!res.tempFilePath) {
|
||||
alertError("获取文件失败")
|
||||
rej()
|
||||
return;
|
||||
}
|
||||
wx.openDocument({
|
||||
filePath: res.tempFilePath,
|
||||
fileType: [ "pdf"], // 3. 这个必须写合法类型,不然下载不了 !!!
|
||||
success: function (res) {
|
||||
resolve()
|
||||
},
|
||||
fail: function (e) {
|
||||
alertError("打开失败")
|
||||
console.log('打开失败错误为', e)
|
||||
rej()
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
loadingFunc(async () => {
|
||||
await handleDownload();
|
||||
})
|
||||
},
|
||||
back() {
|
||||
wx.navigateBack();
|
||||
|
|
|
@ -7,11 +7,13 @@
|
|||
</view>
|
||||
<view class="tenementPicker" bind:tap="clickMeter">
|
||||
<view wx:if="{{meterCode}}" class="tenementName"> {{ meterCode }} </view>
|
||||
<view wx:else> 全部 </view>
|
||||
<view wx:else> 全部电表 </view>
|
||||
<van-icon name="arrow-down" custom-class="down" />
|
||||
</view>
|
||||
<view class="allMoney">
|
||||
合计: {{amount}}元
|
||||
<view class="tenementPicker" bind:tap="clickType">
|
||||
<view wx:if="{{typeText}}" class="tenementName"> {{ typeText }} </view>
|
||||
<view wx:else> 全部类型 </view>
|
||||
<van-icon name="arrow-down" custom-class="down" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="wrapper" wx:if="{{list.length}}">
|
||||
|
|
97
pages/special/index.js
Normal file
97
pages/special/index.js
Normal file
|
@ -0,0 +1,97 @@
|
|||
// pages/special/index.js
|
||||
import { getServicesList } from '../../service/system'
|
||||
import request from '../../utils/request'
|
||||
import { alertInfo } from '../../utils/index'
|
||||
const { OK } = request;
|
||||
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
servicesList: []
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
|
||||
},
|
||||
async init() {
|
||||
const { code, message, data } = await getServicesList()
|
||||
if (code !== OK) {
|
||||
alertInfo(message);
|
||||
return;
|
||||
}
|
||||
this.setData({ servicesList: data })
|
||||
},
|
||||
clickService(e) {
|
||||
console.log('e', e)
|
||||
const { type, value } = e.currentTarget.dataset.data;
|
||||
switch(type) {
|
||||
case 0:
|
||||
const [appId, path] = value.split(",")
|
||||
wx.navigateToMiniProgram({
|
||||
appId: appId,
|
||||
path: path,
|
||||
envVersion: "trial"
|
||||
})
|
||||
break;
|
||||
case 1:
|
||||
wx.navigateTo({
|
||||
url: value,
|
||||
})
|
||||
break;
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
this.init()
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage() {
|
||||
|
||||
}
|
||||
})
|
9
pages/special/index.json
Normal file
9
pages/special/index.json
Normal file
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"usingComponents": {
|
||||
"navigator": "/components/navigator/index",
|
||||
"van-row": "@vant/weapp/row/index",
|
||||
"van-col": "@vant/weapp/col/index",
|
||||
"van-image": "@vant/weapp/image/index"
|
||||
},
|
||||
"navigationStyle": "custom"
|
||||
}
|
11
pages/special/index.wxml
Normal file
11
pages/special/index.wxml
Normal file
|
@ -0,0 +1,11 @@
|
|||
<!--pages/special/index.wxml-->
|
||||
<navigator title="专区" />
|
||||
<view class="servicesWrapper">
|
||||
<van-row>
|
||||
<van-col span="8" wx:for="{{ servicesList }}" wx:key="id">
|
||||
<view class="image" bind:tap="clickService" data-data="{{item}}">
|
||||
<van-image fit="cover" width="200rpx" height="200rpx" src="{{item.url}}" />
|
||||
</view>
|
||||
</van-col>
|
||||
</van-row>
|
||||
</view>
|
6
pages/special/index.wxss
Normal file
6
pages/special/index.wxss
Normal file
|
@ -0,0 +1,6 @@
|
|||
/* pages/special/index.wxss */
|
||||
.image {
|
||||
width: 100%;
|
||||
height: auto;
|
||||
padding: 40rpx;
|
||||
}
|
|
@ -28,7 +28,6 @@
|
|||
},
|
||||
"enableEngineNative": false,
|
||||
"bundle": false,
|
||||
"useIsolateContext": true,
|
||||
"useCompilerModule": true,
|
||||
"userConfirmedUseCompilerModuleSwitch": false,
|
||||
"userConfirmedBundleSwitch": false,
|
||||
|
|
43
service/public.js
Normal file
43
service/public.js
Normal file
|
@ -0,0 +1,43 @@
|
|||
import apis from '../utils/request';
|
||||
import { getConfigByEnv } from "../utils/index"
|
||||
const { GET, POST, PUT, DELETE } = apis
|
||||
|
||||
export const uploadFile = (filePath) => {
|
||||
const { api } = getConfigByEnv();
|
||||
return new Promise((resolve, reject) => {
|
||||
wx.uploadFile({
|
||||
filePath: filePath,
|
||||
name: 'file',
|
||||
url: `${api}/file/upload`,
|
||||
header: {
|
||||
authorization: 'Bearer ' + wx.getStorageSync("token")
|
||||
},
|
||||
success: (res) => {
|
||||
resolve(res);
|
||||
},
|
||||
fail: (err) => {
|
||||
reject(err);
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
export const uploadPublicFile = (filePath) => {
|
||||
const { api } = getConfigByEnv();
|
||||
return new Promise((resolve, reject) => {
|
||||
wx.uploadFile({
|
||||
filePath: filePath,
|
||||
name: 'file',
|
||||
url: `${api}/wx/public/upload`,
|
||||
header: {
|
||||
authorization: wx.getStorageSync("token")
|
||||
},
|
||||
success: (res) => {
|
||||
resolve(res);
|
||||
},
|
||||
fail: (err) => {
|
||||
reject(err);
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
|
@ -21,3 +21,8 @@ export const getRechargeDetail = async function(rid) {
|
|||
export const returnFee = async function(data) {
|
||||
return await POST(`/wx/return`, data);
|
||||
}
|
||||
|
||||
// 创建对公
|
||||
export const createPublicTopUp = async function(data) {
|
||||
return await POST(`/wx/createPublicTopUp`, data);
|
||||
}
|
|
@ -30,3 +30,23 @@ export const deleteOption = async function() {
|
|||
export const aboutUs = async function() {
|
||||
return await GET(`/wx/aboutUs`);
|
||||
}
|
||||
|
||||
// 获取特色服务列表
|
||||
export const getServicesList = async function() {
|
||||
return await GET(`/wx/getServicesList?status=2`);
|
||||
}
|
||||
|
||||
// 获取分类列表
|
||||
export const getCategoryList = async function() {
|
||||
return await GET(`/wx/getCategoryList?status=2`);
|
||||
}
|
||||
|
||||
// 获取分类列表
|
||||
export const getEncyclopediaList = async function(categoryId, page) {
|
||||
return await GET(`/wx/getEncyclopedia?status=2&page=${page}&categoryId=${categoryId}`);
|
||||
}
|
||||
|
||||
// 获取分类列表
|
||||
export const getEncyclopediaDetail = async function(id) {
|
||||
return await GET(`/wx/getEncyclopediaDetail/${id}`);
|
||||
}
|
|
@ -47,6 +47,7 @@ export function getConfigByEnv() {
|
|||
case 'develop':
|
||||
api = "http://localhost:8000"
|
||||
// api = "https://zgd.hbhcbn.com/api3"
|
||||
// api = "https://zgd.hbhcbn.com/api3"
|
||||
// api = "https://zgd.hbhcbn.com/wxApi"
|
||||
// api = "http://127.0.0.1:4523/m1/4143821-0-default"
|
||||
break;
|
||||
|
@ -248,3 +249,8 @@ export function getPageUrl() {
|
|||
const url = currentPage.route //当前页面url
|
||||
return url
|
||||
}
|
||||
|
||||
/** 根据文件路径获取文件名 */
|
||||
export function getFileName(path) {
|
||||
return path.slice(path.lastIndexOf("/") + 1, -1)
|
||||
}
|
|
@ -85,6 +85,10 @@ const parseResponse = function (response, url) {
|
|||
// const { statusCode } = response;
|
||||
const { code } = response?.data || {};
|
||||
console.log('url', url,'code', code, 'response.data', response.data)
|
||||
if (!code) {
|
||||
alertError("服务异常")
|
||||
return
|
||||
}
|
||||
if (code === 401) {
|
||||
const currentUrl = getPageUrl()
|
||||
|
||||
|
|
|
@ -11,11 +11,11 @@ export const getDot = async () => {
|
|||
const { code, message, data } = await getUnReadApproveNumber();
|
||||
if (data > 0) {
|
||||
wx.showTabBarRedDot({
|
||||
index: 1,
|
||||
index: 2,
|
||||
})
|
||||
} else {
|
||||
wx.hideTabBarRedDot({
|
||||
index: 1,
|
||||
index: 2,
|
||||
})
|
||||
}
|
||||
return data;
|
||||
|
|
Loading…
Reference in New Issue
Block a user