Compare commits

..

12 Commits

27 changed files with 239 additions and 53 deletions

1
app.js
View File

@ -8,7 +8,6 @@ App({
onLaunch() {
const { api } = getConfigByEnv();
this.globalData = { ...this.globalData, api, }
},
globalData: {
primaryColor: '#52c41a'

View File

@ -193,7 +193,6 @@ Page({
})
},
async onChangePage(e) {
console.log('e', e)
const page = e.detail.currentIndex;
const that = this;
this.setData({
@ -284,7 +283,6 @@ Page({
});
break;
case "day":
console.log('day')
this.setData({
yearMonthDay: time,
yearMonthDayStamp: new Date(time).getTime(),

View File

@ -90,7 +90,6 @@ Component({
},
//更改页码点击事件
onChangePage: function (e) {
//console.log("更改页码事件:",e);
this.setData({
pageMask: false,
index: e.currentTarget.dataset.index //点击的页数

View File

@ -9,7 +9,7 @@
<view class="page-mask" bindtap="hidePagePopup"></view>
<view class="page-popup">
<view class="page-popup-box">
<view class="page-line" wx:for="{{total}}" wx:for-index="idx" data-index="{{idx+1}}" bindtap="changePage">第{{item+1}}页</view>
<view class="page-line" wx:for="{{total}}" wx:key="index" wx:for-index="idx" data-index="{{idx+1}}" bindtap="changePage">第{{item+1}}页</view>
</view>
</view>
</view>

View File

@ -1,4 +1,4 @@
import { getParkList } from "../../service/park";
import { getLoginParkList } from "../../service/park";
import { getTenementList } from "../../service/tenement";
import request from '../../utils/request'
@ -32,7 +32,7 @@ Component({
async onInput(e) {
switch(this.data.type) {
case 0:
const { data = [], code, message } = await getParkList({ keyword: e.detail });
const { data = [], code, message } = await getLoginParkList({ keyword: e.detail });
this.setData({
list: data,
visible: true,

View File

@ -21,7 +21,6 @@ Component({
},
lifetimes: {
attached() {
console.log('----------=========')
this.getData();
}
},
@ -29,7 +28,7 @@ Component({
* 组件的方法列表
*/
methods: {
async getData() {
async init() {
const page = this.data.page;
const id = this.id;
const { code, data, message, total } = await getEncyclopediaList(id, page);
@ -39,8 +38,12 @@ Component({
}
this.setData({ list: data, totalPage: Math.ceil(total / 20) });
},
async getData() {
loadingFunc(async() => {
await this.init();
})
},
jumpToDetail(e) {
console.log('e', e)
wx.navigateTo({
url: `/pages/encyclopediaDetail/index?id=${e.currentTarget.dataset.data.id}`,
})

View File

@ -31,7 +31,6 @@ Page({
})
},
onChange(e) {
console.log('e', e)
this.setData({
active: e.detail.index,
})

View File

@ -1,6 +1,6 @@
// pages/home/index.js
import { getMeterDetail, getMeterList, getTenementMeterList } from "../../service/meter";
import { getOwnTenementList } from "../../service/tenement";
import { getOwnTenementList, getTenementExceptionalCase } from "../../service/tenement";
import { alertInfo, alertSuccess } from "../../utils/index";
import request from '../../utils/request';
import { getDot } from "../../utils/system";
@ -125,6 +125,15 @@ Page({
},
async recharge() {
const { user, money, meter, tenement, park } = this.data;
const { code, message, data } = await getTenementExceptionalCase(park?.id, tenement?.id);
if (code !== OK) {
alertInfo(message)
return;
}
if (data === 1) {
alertInfo("账号存在异常,无法进行充值,请联系客服处理")
return;
}
const that = this;
if (!user || !user.id) {
alertInfo("请先登录")

View File

@ -1,6 +1,6 @@
// pages/invoiceInfo/index.js
import { getInvoiceInfoDetail, downloadInvoice } from "../../service/invoice";
import { alertError, alertInfo, loadingFunc } from "../../utils/index";
import { alertError, alertInfo, alertSuccess, loadingFunc } from "../../utils/index";
import request from '../../utils/request'
const { OK } = request;
Page({
@ -36,9 +36,9 @@ Page({
const that = this;
wx.showActionSheet({
itemList: ['发票XML文件下载', '发票PDF文件下载'],
async success(res) {
async success(sheetRes) {
loadingFunc(async () => {
const { code, message, data } = await downloadInvoice(that.data.id, res.tapIndex);
const { code, message, data } = await downloadInvoice(that.data.id, sheetRes.tapIndex);
if (code !== OK) {
alertInfo(message)
return;
@ -47,6 +47,29 @@ Page({
alertInfo("暂无文档信息")
return
}
if (sheetRes.tapIndex === 0) {
wx.showModal({
title: '提示',
content: '暂不支持xml格式预览请复制链接后打开浏览器下载',
confirmText: '复制链接',
showCancel: true,
complete: (res) => {
if (res.cancel) {
}
if (res.confirm) {
wx.setClipboardData({
data,
success: () => {
alertSuccess("复制成功")
}
})
}
}
})
return;
}
wx.downloadFile({
url: data,
success(res) {
@ -57,7 +80,7 @@ Page({
}
wx.openDocument({
filePath: res.tempFilePath,
fileType: [res.tapIndex === 0 ? 'xml' : "pdf"], // 3. 这个必须写合法类型,不然下载不了
// fileType: sheetRes.tapIndex === 0 ? 'xml' : "pdf", // 3. 这个必须写合法类型,不然下载不了
success: function (res) {
},

View File

@ -65,7 +65,6 @@ Page({
},
getPhoneNumber(e) {
const { errno, code: phoneCode } = e.detail;
console.log('e', e)
switch(errno) {
case 103:
alertInfo("已拒绝");

View File

@ -4,6 +4,7 @@ import { createPublicTopUp } from '../../service/recharge'
import { uploadFile, uploadPublicFile } from "../../service/public";
import { alertInfo, loadingFunc, getFileName, alertSuccess } from "../../utils/index";
import request from '../../utils/request';
import Dialog from '@vant/weapp/dialog/dialog';
const { OK } = request;
@ -38,6 +39,7 @@ Page({
})
},
async upload(res) {
const result = await uploadPublicFile(res.tempFiles[0]?.tempFilePath)
if (result.statusCode !== 200) {
alertInfo("上传失败")
@ -54,6 +56,11 @@ Page({
mediaType: ['image'], // 可以选择文件的类型,这里只允许上传文件
sourceType: ['album', 'camera'],
success: (res) => {
const file = res.tempFiles[0];
if (file.size / 1024 / 1024 > 1) {
alertInfo("文件不能大于1M")
return;
}
loadingFunc(async () => {
await this.upload(res)
})
@ -77,11 +84,24 @@ Page({
alertInfo(message)
return;
}
alertSuccess("已提交,待审核")
setTimeout(() => {
wx.redirectTo({
Dialog.alert({
title: '提示',
message: '订单提交成功!请耐心等待管理员审核,如果疑问请联系客服',
confirmButtonOpenType: "contact",
showCancelButton: true,
confirmButtonText: "联系客服",
cancelButtonText: "关闭"
}).then(() => {
wx.switchTab({
url: '/pages/home/index',
})
}).catch(() => {
wx.redirectTo({
url: '/pages/rechargeRecord/index',
})
});
setTimeout(() => {
}, 600)
},
handleDelete() {

View File

@ -3,6 +3,7 @@
"navigator": "/components/navigator/index",
"van-field": "@vant/weapp/field/index",
"van-uploader": "@vant/weapp/uploader/index",
"van-dialog": "@vant/weapp/dialog/index",
"van-button": "@vant/weapp/button/index"
},
"navigationStyle": "custom"

View File

@ -23,3 +23,4 @@
<van-button bind:tap="handleSubmit" type="info" block style="margin-top: 20rpx;"> 提交 </van-button>
</view>
<van-dialog id="van-dialog" />

View File

@ -27,7 +27,7 @@ Page({
return;
}
let next = true;
if (total <= page * 20) {
if (total <= page / 20) {
next = false;
}
this.setData({

View File

@ -1,7 +1,8 @@
{
"usingComponents": {
"navigator": "/components/navigator/index",
"scrollPageWrapper": "/components/scrollPageWrapper/index"
"scrollPageWrapper": "/components/scrollPageWrapper/index",
"empty": "/components/empty/index"
},
"navigationStyle": "custom"
}

View File

@ -2,9 +2,12 @@
<scrollPageWrapper>
<navigator title="常见问题" canBack="{{true}}" />
<view class="content">
<view wx:if="{{questions.length}}">
<view wx:for="{{questions}}" wx:key="index">
<view class="question"> {{index + 1}}、 {{ item.name }} </view>
<view class="answer"> {{ item.content }} </view>
</view>
</view>
<empty wx:else="" bind:refresh="getList" />
</view>
</scrollPageWrapper>

View File

@ -33,9 +33,18 @@ Page({
})
},
record() {
const { detail } = this.data;
if (detail.orderStatus === 1) {
alertInfo("审核中的充值不能开收据")
return;
}
if (detail.orderStatus === 2) {
alertInfo("已退回的充值不能开收据")
return;
}
const handleDownload = () => {
return new Promise((resolve, rej) => {
const { detail } = this.data;
const result = wx.getAccountInfoSync();
const { envVersion } = result.miniProgram;
let api = ""
@ -55,17 +64,19 @@ Page({
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("获取文件失败")
alertInfo("获取文件失败")
rej()
return;
}
if (res.tempFilePath.endsWith(".json")) {
alertInfo("下载文件失败")
return;
}
wx.openDocument({
filePath: res.tempFilePath,
fileType: [ "pdf"], // 3. 这个必须写合法类型,不然下载不了

View File

@ -83,6 +83,37 @@
readonly
border="{{ false }}"
/>
<van-field
value="处理中"
label="订单状态"
readonly
border="{{ false }}"
wx:if="{{detail.orderStatus === 1}}"
/>
<van-field
value="已退回"
label="订单状态"
readonly
border="{{ false }}"
wx:elif="{{detail.orderStatus === 2}}"
/>
<van-field
value="已充值"
label="订单状态"
readonly
border="{{ false }}"
wx:else
/>
<van-field
value="{{detail.reason}}"
label="拒绝理由"
type="textarea"
autosize="{{true}}"
readonly
border="{{ false }}"
wx:if="{{detail.orderStatus === 2}}"
/>
</van-cell-group>
<view class="operate">

View File

@ -3,6 +3,7 @@ import { getRechargeList } from "../../service/recharge";
import { getTenementMeterList } from "../../service/meter";
import { getYears, alertInfo, loadingFunc } from "../../utils/index";
import request from "../../utils/request";
import Dialog from '@vant/weapp/dialog/dialog';
const { OK } = request;
Page({
@ -16,6 +17,7 @@ Page({
list: [
],
way: ["现金", "银行卡", "支付宝", "微信", "云闪付","对公转账", "小程序-微信支付"],
show: false,
columns: [],
type: "",
@ -40,6 +42,18 @@ Page({
title: "表计"
})
},
clickType() {
this.setData({
type: "pay",
columns: [
{id: undefined, name: "全部" },
{id: 1, name: "对公" },
{id: 2, name: "微信" },
],
show: true,
title: "充值类型"
})
},
onOk(e) {
const { type, value = {} } = e.detail;
if (type === "year") {
@ -50,9 +64,13 @@ Page({
this.onChangeMeter(value)
return;
}
if (type === "pay") {
this.onChangePay(value)
return;
}
},
onChangeYear(e) {
const { codeId } = this.data;
const { codeId, pay } = this.data;
const currentYear = e
this.setData({
year: currentYear,
@ -60,11 +78,19 @@ Page({
show: false,
title: ""
})
this.init(currentYear, codeId)
this.init(currentYear, codeId, pay)
},
showAnswer() {
Dialog.alert({
title: '提示',
message: '只统计已完成充值的数据,处理中和已退回不计入总额内',
}).then(() => {
// on close
});
},
onChangeMeter(e) {
const { id, code } = e;
const { year } = this.data;
const { id, code, } = e;
const { year, pay } = this.data;
this.setData({
codeId: id,
meterCode: code,
@ -72,7 +98,19 @@ Page({
show: false,
title: ""
})
this.init(year, id)
this.init(year, id, pay)
},
onChangePay(e) {
const { id, name } = e;
console.log('e', e)
const { year, codeId } = this.data;
this.setData({
payType: name,
type: "",
show: false,
title: ""
})
this.init(year,codeId, id, )
},
/**
* 生命周期函数--监听页面显示
@ -102,8 +140,8 @@ Page({
meterList: data || [],
})
},
async init(year, codeId) {
const { code, message, data = [], amount = 0 } = await getRechargeList(year, codeId);
async init(year, codeId, pay) {
const { code, message, data = [], amount = 0 } = await getRechargeList(year, codeId, pay);
if (code !== OK) {
alertInfo(message)
return;

View File

@ -5,7 +5,9 @@
"van-icon": "@vant/weapp/icon/index",
"custom-status-bar": "/components/customStatusBar/index",
"custom-picker": "/components/picker/index",
"empty": "/components/empty/index"
"empty": "/components/empty/index",
"van-dialog": "@vant/weapp/dialog/index",
"van-divider": "@vant/weapp/divider/index"
},
"navigationStyle": "custom"
}

View File

@ -11,7 +11,7 @@
<van-icon name="arrow-down" custom-class="down" />
</view>
<view class="tenementPicker" bind:tap="clickType">
<view wx:if="{{typeText}}" class="tenementName"> {{ typeText }} </view>
<view wx:if="{{payType}}" class="tenementName"> {{ payType }} </view>
<view wx:else> 全部类型 </view>
<van-icon name="arrow-down" custom-class="down" />
</view>
@ -25,10 +25,22 @@
<view class="codeTime">
<view class="code"> {{ item.meter.address }} </view>
<view class="time"> {{ item.time }} </view>
<view class="way"> {{ way[item.paymentType] }} </view>
</view>
<view class="money"> {{ item.money }}元 </view>
<van-icon name="arrow" />
<view class="rechargeStatus rechargeWait" wx:if="{{item.orderStatus === 1}}"> 处理中 </view>
<view class="rechargeStatus rechargeBack" wx:elif="{{item.orderStatus === 2}}"> 已退回 </view>
<view class="rechargeStatus rechargeSuccess" wx:else> 充值成功 </view>
</view>
<view class="allMoney"> 总计<van-icon name="question-o" bind:click="showAnswer" style="font-size: 40rpx; margin-left: 8rpx;margin-right:8rpx;" />{{amount}} </view>
<van-divider
contentPosition="center"
>
没有更多了
</van-divider>
<view style="height: 40rpx;"></view>
</view>
</view>
<view wx:else>
@ -43,3 +55,4 @@
bind:cancel="onCancel"
type="{{type}}"
/>
<van-dialog id="van-dialog" />

View File

@ -28,6 +28,7 @@
border-right: 0;
border-top: 0;
align-items: center;
position: relative;
}
.recordsItem:last-child {
border-bottom: 0;
@ -68,10 +69,10 @@
}
.allMoney {
flex: 1;
font-size: 34rpx;
margin-top: 24rpx;
margin-bottom: 20rpx;
text-align: right;
color: #fff;
font-size: 32rpx;
}
.type {
@ -90,3 +91,29 @@
white-space: nowrap;
text-overflow: ellipsis;
}
.way {
margin-top: 10rpx;
font-size: 24rpx;
}
.rechargeStatus {
position: absolute;
right: 0;
top: 0;
z-index: 99;
font-size: 26rpx;
padding: 4rpx 10rpx;
}
.rechargeWait {
background-color: rgb(234,226,26);
}
.rechargeSuccess {
background-color: rgb(88,165,141);
}
.rechargeBack {
background-color: rgb(229,229,229);
}

View File

@ -30,6 +30,10 @@ Page({
clickService(e) {
console.log('e', e)
const { type, value } = e.currentTarget.dataset.data;
if (!value) {
alertInfo("暂未开通")
return;
}
switch(type) {
case 0:
const [appId, path] = value.split(",")

View File

@ -4,3 +4,8 @@
height: auto;
padding: 40rpx;
}
.servicesWrapper {
min-height: 80vh;
background: linear-gradient(to bottom, var(--middle-green), #fff );
}

View File

@ -19,8 +19,6 @@
"uploadWithSourceMap": true,
"compileHotReLoad": false,
"useMultiFrameRuntime": true,
"useApiHook": true,
"useApiHostProcess": true,
"babelSetting": {
"ignore": [],
"disablePlugins": [],
@ -39,19 +37,16 @@
}
],
"minifyWXSS": true,
"compileWorklet": false,
"ignoreUploadUnusedFiles": false,
"useIsolateContext": true
"ignoreUploadUnusedFiles": false
},
"editorSetting": {
"tabIndent": "insertSpaces",
"tabSize": 2
},
"condition": {},
"packOptions": {
"ignore": [],
"include": []
},
"appid": "wxb34b4e70f8a5c6f1",
"projectname": "elec",
"condition": {}
"appid": "wxb34b4e70f8a5c6f1"
}

View File

@ -2,9 +2,9 @@ import apis from '../utils/request';
const { GET, POST, PUT, DELETE } = apis
// 获取充值记录
export const getRechargeList = async function(year, codeId) {
export const getRechargeList = async function(year = "", codeId = "", pay = "") {
const tenement = wx.getStorageSync('tenement')?.id
return await GET(`/wx/getRechargeList?year=${year}&tenement=${tenement}&codeId=${codeId}`);
return await GET(`/wx/getRechargeList?year=${year}&tenement=${tenement}&codeId=${codeId}&pay=${pay}`);
}
// 预备充值请求

View File

@ -15,3 +15,8 @@ export const getOwnTenementList = async function() {
export const getTenementDetail = async function(id) {
return await GET(`/wx/getTenementDetail/${id}`);
}
// 获取商户是否限电
export const getTenementExceptionalCase = async function(pid, tid) {
return await GET(`/wx/exceptionalCase/${pid}/${tid}`);
}