diff --git a/app.json b/app.json
index 57ccd30..124079b 100644
--- a/app.json
+++ b/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": "我的",
diff --git a/assets/tabbar/special.png b/assets/tabbar/special.png
new file mode 100644
index 0000000..475ff5e
Binary files /dev/null and b/assets/tabbar/special.png differ
diff --git a/assets/tabbar/special_select.png b/assets/tabbar/special_select.png
new file mode 100644
index 0000000..5fb8c95
Binary files /dev/null and b/assets/tabbar/special_select.png differ
diff --git a/childPackage/pages/billDetail/index.js b/childPackage/pages/billDetail/index.js
index 7472ed6..be7ddf3 100644
--- a/childPackage/pages/billDetail/index.js
+++ b/childPackage/pages/billDetail/index.js
@@ -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)' } },
],
}
diff --git a/childPackage/pages/billDetail/index.wxml b/childPackage/pages/billDetail/index.wxml
index d1057e1..fb72226 100644
--- a/childPackage/pages/billDetail/index.wxml
+++ b/childPackage/pages/billDetail/index.wxml
@@ -32,7 +32,7 @@
本期用电量
- {{ detail.comprehensive.consumption }} 千瓦时
+ {{ amount }} 千瓦时
diff --git a/components/pagination/index.wxml b/components/pagination/index.wxml
index 4005047..4d599db 100644
--- a/components/pagination/index.wxml
+++ b/components/pagination/index.wxml
@@ -14,4 +14,3 @@
-{{totalPage}}
diff --git a/pages/encyclopedia/components/item/index.js b/pages/encyclopedia/components/item/index.js
new file mode 100644
index 0000000..46a8046
--- /dev/null
+++ b/pages/encyclopedia/components/item/index.js
@@ -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();
+ })
+ },
+ }
+})
\ No newline at end of file
diff --git a/pages/encyclopedia/components/item/index.json b/pages/encyclopedia/components/item/index.json
new file mode 100644
index 0000000..ad53950
--- /dev/null
+++ b/pages/encyclopedia/components/item/index.json
@@ -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"
+}
\ No newline at end of file
diff --git a/pages/encyclopedia/components/item/index.wxml b/pages/encyclopedia/components/item/index.wxml
new file mode 100644
index 0000000..e3ba148
--- /dev/null
+++ b/pages/encyclopedia/components/item/index.wxml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/encyclopedia/components/item/index.wxss b/pages/encyclopedia/components/item/index.wxss
new file mode 100644
index 0000000..df85e8e
--- /dev/null
+++ b/pages/encyclopedia/components/item/index.wxss
@@ -0,0 +1 @@
+/* pages/encyclopedia/components/item/index.wxss */
\ No newline at end of file
diff --git a/pages/encyclopedia/index.js b/pages/encyclopedia/index.js
new file mode 100644
index 0000000..772df41
--- /dev/null
+++ b/pages/encyclopedia/index.js
@@ -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() {
+
+ }
+})
\ No newline at end of file
diff --git a/pages/encyclopedia/index.json b/pages/encyclopedia/index.json
new file mode 100644
index 0000000..306142e
--- /dev/null
+++ b/pages/encyclopedia/index.json
@@ -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"
+}
\ No newline at end of file
diff --git a/pages/encyclopedia/index.wxml b/pages/encyclopedia/index.wxml
new file mode 100644
index 0000000..a00ca80
--- /dev/null
+++ b/pages/encyclopedia/index.wxml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/encyclopedia/index.wxss b/pages/encyclopedia/index.wxss
new file mode 100644
index 0000000..e67e696
--- /dev/null
+++ b/pages/encyclopedia/index.wxss
@@ -0,0 +1 @@
+/* pages/encyclopedia/index.wxss */
\ No newline at end of file
diff --git a/pages/encyclopediaDetail/index.js b/pages/encyclopediaDetail/index.js
new file mode 100644
index 0000000..2eacec4
--- /dev/null
+++ b/pages/encyclopediaDetail/index.js
@@ -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() {
+
+ }
+})
\ No newline at end of file
diff --git a/pages/encyclopediaDetail/index.json b/pages/encyclopediaDetail/index.json
new file mode 100644
index 0000000..a6d770b
--- /dev/null
+++ b/pages/encyclopediaDetail/index.json
@@ -0,0 +1,6 @@
+{
+ "usingComponents": {
+ "navigator": "/components/navigator/index"
+ },
+ "navigationStyle": "custom"
+}
\ No newline at end of file
diff --git a/pages/encyclopediaDetail/index.wxml b/pages/encyclopediaDetail/index.wxml
new file mode 100644
index 0000000..691d43d
--- /dev/null
+++ b/pages/encyclopediaDetail/index.wxml
@@ -0,0 +1,6 @@
+
+
+
+ {{detail.title}}
+ {{detail.content}}
+
diff --git a/pages/encyclopediaDetail/index.wxss b/pages/encyclopediaDetail/index.wxss
new file mode 100644
index 0000000..c5e5a07
--- /dev/null
+++ b/pages/encyclopediaDetail/index.wxss
@@ -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;
+
+}
\ No newline at end of file
diff --git a/pages/handleLogin/index.js b/pages/handleLogin/index.js
index 87ab42f..2ac8d9c 100644
--- a/pages/handleLogin/index.js
+++ b/pages/handleLogin/index.js
@@ -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({
diff --git a/pages/handleLogin/index.wxml b/pages/handleLogin/index.wxml
index 67a3e47..d23c8a9 100644
--- a/pages/handleLogin/index.wxml
+++ b/pages/handleLogin/index.wxml
@@ -1,6 +1,6 @@
-
+
diff --git a/pages/home/index.js b/pages/home/index.js
index 2ce113b..c5c6793 100644
--- a/pages/home/index.js
+++ b/pages/home/index.js
@@ -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();
diff --git a/pages/publicTransfer/index.js b/pages/publicTransfer/index.js
new file mode 100644
index 0000000..bdae1ef
--- /dev/null
+++ b/pages/publicTransfer/index.js
@@ -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() {
+
+ }
+})
\ No newline at end of file
diff --git a/pages/publicTransfer/index.json b/pages/publicTransfer/index.json
new file mode 100644
index 0000000..c2a876c
--- /dev/null
+++ b/pages/publicTransfer/index.json
@@ -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"
+}
\ No newline at end of file
diff --git a/pages/publicTransfer/index.wxml b/pages/publicTransfer/index.wxml
new file mode 100644
index 0000000..7d31d4f
--- /dev/null
+++ b/pages/publicTransfer/index.wxml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
+ 点击上传
+
+
+
+
+
+
+
+ 提交
+
\ No newline at end of file
diff --git a/pages/publicTransfer/index.wxss b/pages/publicTransfer/index.wxss
new file mode 100644
index 0000000..9e7911d
--- /dev/null
+++ b/pages/publicTransfer/index.wxss
@@ -0,0 +1 @@
+/* pages/publicTransfer/index.wxss */
\ No newline at end of file
diff --git a/pages/recharge/index.js b/pages/recharge/index.js
deleted file mode 100644
index 780ab6d..0000000
--- a/pages/recharge/index.js
+++ /dev/null
@@ -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() {
-
- }
-})
\ No newline at end of file
diff --git a/pages/recharge/index.json b/pages/recharge/index.json
deleted file mode 100644
index 6618c57..0000000
--- a/pages/recharge/index.json
+++ /dev/null
@@ -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": "充值"
-}
\ No newline at end of file
diff --git a/pages/recharge/index.wxml b/pages/recharge/index.wxml
deleted file mode 100644
index c765007..0000000
--- a/pages/recharge/index.wxml
+++ /dev/null
@@ -1,51 +0,0 @@
-
-
-
-
-
-
- 充值表号:
- {{ detail.meter.code }}
-
-
- 表计地址:
- {{ detail.meter.address }}
-
-
-
- 剩余金额:
- {{ detail.money }}
-
-
- 公司名称:
- {{ detail.tenement.name }}
-
-
-
-
- {{item}}
- 自定义
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/pages/recharge/index.wxss b/pages/recharge/index.wxss
deleted file mode 100644
index a62e17e..0000000
--- a/pages/recharge/index.wxss
+++ /dev/null
@@ -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;
-}
\ No newline at end of file
diff --git a/pages/rechargeDetail/index.js b/pages/rechargeDetail/index.js
index cd5ec8a..c36b4d3 100644
--- a/pages/rechargeDetail/index.js
+++ b/pages/rechargeDetail/index.js
@@ -33,42 +33,58 @@ Page({
})
},
record() {
- 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}`,
- })
- break;
- // 体验版
- case 'trial':
- wx.setClipboardData({
- data: `http://1.92.72.5:8080/recharge-print/?id=${detail.id}`,
- })
- break;
- // 正式版
- case 'release':
- wx.setClipboardData({
- data: `https://zgd.hbhcbn.com/recharge-print/?id=${detail.id}`,
- })
- break;
- }
-
+ const handleDownload = () => {
+ return new Promise((resolve, rej) => {
+ const { detail } = this.data;
+ const result = wx.getAccountInfoSync();
+ const { envVersion } = result.miniProgram;
+ let api = ""
+ switch (envVersion) {
+ // 开发版
+ case 'develop':
+ // 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':
+ api = `https://zgd.hbhcbn.com/recharge-print-api-test`;
+ break;
+ // 正式版
+ case 'release':
+ 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() {
diff --git a/pages/rechargeRecord/index.wxml b/pages/rechargeRecord/index.wxml
index 73ac1df..dac645a 100644
--- a/pages/rechargeRecord/index.wxml
+++ b/pages/rechargeRecord/index.wxml
@@ -7,11 +7,13 @@
{{ meterCode }}
- 全部
+ 全部电表
-
- 合计: {{amount}}元
+
+ {{ typeText }}
+ 全部类型
+
diff --git a/pages/special/index.js b/pages/special/index.js
new file mode 100644
index 0000000..35069e2
--- /dev/null
+++ b/pages/special/index.js
@@ -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() {
+
+ }
+})
\ No newline at end of file
diff --git a/pages/special/index.json b/pages/special/index.json
new file mode 100644
index 0000000..73912f2
--- /dev/null
+++ b/pages/special/index.json
@@ -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"
+}
\ No newline at end of file
diff --git a/pages/special/index.wxml b/pages/special/index.wxml
new file mode 100644
index 0000000..1f0588e
--- /dev/null
+++ b/pages/special/index.wxml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/special/index.wxss b/pages/special/index.wxss
new file mode 100644
index 0000000..4245294
--- /dev/null
+++ b/pages/special/index.wxss
@@ -0,0 +1,6 @@
+/* pages/special/index.wxss */
+.image {
+ width: 100%;
+ height: auto;
+ padding: 40rpx;
+}
\ No newline at end of file
diff --git a/project.config.json b/project.config.json
index 2b41c5a..e87cb07 100644
--- a/project.config.json
+++ b/project.config.json
@@ -28,7 +28,6 @@
},
"enableEngineNative": false,
"bundle": false,
- "useIsolateContext": true,
"useCompilerModule": true,
"userConfirmedUseCompilerModuleSwitch": false,
"userConfirmedBundleSwitch": false,
diff --git a/service/public.js b/service/public.js
new file mode 100644
index 0000000..54e2045
--- /dev/null
+++ b/service/public.js
@@ -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);
+ }
+ })
+ })
+}
\ No newline at end of file
diff --git a/service/recharge.js b/service/recharge.js
index 014cd8a..4643df3 100644
--- a/service/recharge.js
+++ b/service/recharge.js
@@ -20,4 +20,9 @@ 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);
}
\ No newline at end of file
diff --git a/service/system.js b/service/system.js
index b018172..db5407a 100644
--- a/service/system.js
+++ b/service/system.js
@@ -29,4 +29,24 @@ 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}`);
}
\ No newline at end of file
diff --git a/utils/index.js b/utils/index.js
index 87f675e..a9359ec 100644
--- a/utils/index.js
+++ b/utils/index.js
@@ -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;
@@ -247,4 +248,9 @@ export function getPageUrl() {
const currentPage = pages[pages.length-1] //获取当前页面的对象
const url = currentPage.route //当前页面url
return url
+}
+
+/** 根据文件路径获取文件名 */
+export function getFileName(path) {
+ return path.slice(path.lastIndexOf("/") + 1, -1)
}
\ No newline at end of file
diff --git a/utils/request.js b/utils/request.js
index 3b624fd..1d6ed2c 100644
--- a/utils/request.js
+++ b/utils/request.js
@@ -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()
diff --git a/utils/system.js b/utils/system.js
index c54ae76..c3e0002 100644
--- a/utils/system.js
+++ b/utils/system.js
@@ -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;