新增分享功能,修改开票判断逻辑,可查询电表列表
This commit is contained in:
parent
ec77d26c27
commit
b905da6035
18
app.js
18
app.js
@ -6,27 +6,27 @@ function share() {
|
||||
const view = pages[pages.length - 1];
|
||||
if (view) {
|
||||
wx.showShareMenu()
|
||||
view.onShareAppMessage = () => {
|
||||
return {
|
||||
title: "",
|
||||
path: "/pages/home/index",
|
||||
imageUrl: "/assets/images/share.png"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
// app.js
|
||||
App({
|
||||
onShow() {
|
||||
checkUpgrade();
|
||||
},
|
||||
onLaunch() {
|
||||
// wx.showShareMenu()
|
||||
// share()
|
||||
share()
|
||||
const { api } = getConfigByEnv();
|
||||
this.globalData = { ...this.globalData, api, }
|
||||
},
|
||||
// onShareAppMessage:function(){
|
||||
// wx.showShareMenu({
|
||||
// withShareTicket:true,
|
||||
// menu:['shareAppMessage','shareTimeline']
|
||||
// })
|
||||
// },
|
||||
globalData: {
|
||||
primaryColor: '#52c41a'
|
||||
}
|
||||
|
3
app.json
3
app.json
@ -30,7 +30,8 @@
|
||||
"pages/aid/consult/index",
|
||||
"pages/integral/index",
|
||||
"pages/discountCoupon/index",
|
||||
"pages/integralRecord/index"
|
||||
"pages/integralRecord/index",
|
||||
"pages/meterList/index"
|
||||
],
|
||||
"subPackages": [
|
||||
{
|
||||
|
BIN
assets/images/share.png
Normal file
BIN
assets/images/share.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 169 KiB |
@ -124,6 +124,20 @@ Page({
|
||||
onChangeMoney(e) {
|
||||
this.setData({ money: e.detail })
|
||||
},
|
||||
jumpToMeterList() {
|
||||
const { tenement, user } = this.data;
|
||||
if (!user) {
|
||||
alertInfo("请先登录")
|
||||
return
|
||||
}
|
||||
if (!tenement) {
|
||||
alertInfo("请先选择商户")
|
||||
return
|
||||
}
|
||||
wx.navigateTo({
|
||||
url: '/pages/meterList/index?id=' + tenement?.id,
|
||||
})
|
||||
},
|
||||
async recharge() {
|
||||
const { user, money, meter, tenement, park } = this.data;
|
||||
if (!user || !user.id) {
|
||||
|
@ -62,9 +62,20 @@
|
||||
<view class="cardItemValue" style="position: relative;">
|
||||
<view class="text" wx:if="{{user.id}}"> {{meter.money}} </view>
|
||||
<view class="text" wx:else> --- </view>
|
||||
<van-button type="info" size="small" plain="{{true}}" custom-style="position: absolute; right: -20rpx; bottom: -20rpx;z-index: 99;" bind:click="refreshMeter" wx:if="{{user.id}}">
|
||||
<view style="width: 160rpx;display: flex;justify-content: center;"><van-icon name="replay" />
|
||||
刷新</view>
|
||||
<!-- bind:click="jumpToMeterList" -->
|
||||
<van-button
|
||||
type="info"
|
||||
size="small"
|
||||
plain="{{true}}"
|
||||
custom-style="position: absolute; right: -20rpx; bottom: -20rpx;z-index: 99;"
|
||||
wx:if="{{user.id}}"
|
||||
bind:click="refreshMeter"
|
||||
>
|
||||
<view style="width: 160rpx;display: flex;justify-content: center;">
|
||||
<van-icon name="replay" />
|
||||
<!-- 查看全部 -->
|
||||
刷新
|
||||
</view>
|
||||
</van-button>
|
||||
</view>
|
||||
</view>
|
||||
|
@ -33,7 +33,7 @@ Page({
|
||||
alertInfo(message)
|
||||
return;
|
||||
}
|
||||
if (!data?.tenement?.id || !data?.name || !data?.phone || !data?.email) {
|
||||
if (!data?.id) {
|
||||
const user = wx.getStorageSync('user')
|
||||
if (user.isAdmin) {
|
||||
wx.showModal({
|
||||
|
@ -73,7 +73,7 @@
|
||||
<van-field
|
||||
value="{{ detail.phone }}"
|
||||
wx:if="{{detail.headerType === 0}}"
|
||||
label="电话"
|
||||
label="手机号"
|
||||
readonly
|
||||
title-width="132rpx"
|
||||
disabled="{{true}}"
|
||||
|
90
pages/meterList/index.js
Normal file
90
pages/meterList/index.js
Normal file
@ -0,0 +1,90 @@
|
||||
// pages/meterList/index.js
|
||||
import { getTenementMeterList } from "../../service/meter";
|
||||
import { alertInfo } from "../../utils/index";
|
||||
import request from '../../utils/request';
|
||||
const { OK } = request;
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
header: [
|
||||
{ key: 'address', title: '电表地址' },
|
||||
{ key: "money", title: '电表余额', },
|
||||
{ key: 'number', title: '电表总量' },
|
||||
],
|
||||
list: [{}],
|
||||
},
|
||||
async getMeters({ id }) {
|
||||
const { code, message, data } = await getTenementMeterList(id);
|
||||
if (code !== OK) {
|
||||
alertInfo(message)
|
||||
this.setData({ meterList: [], meter: {} })
|
||||
wx.setStorageSync('meter', {})
|
||||
return;
|
||||
}
|
||||
this.setData({
|
||||
list: data || [],
|
||||
})
|
||||
// if (!storageMeter) {
|
||||
wx.setStorageSync('meter', data?.[0] || {} )
|
||||
// }
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
console.log('options', options)
|
||||
this.getMeters({ id: options?.id })
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage() {
|
||||
|
||||
}
|
||||
})
|
7
pages/meterList/index.json
Normal file
7
pages/meterList/index.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
"table": "/components/table/table",
|
||||
"navigator": "/components/navigator/index"
|
||||
},
|
||||
"navigationStyle": "custom"
|
||||
}
|
3
pages/meterList/index.wxml
Normal file
3
pages/meterList/index.wxml
Normal file
@ -0,0 +1,3 @@
|
||||
<!--pages/meterList/index.wxml-->
|
||||
<navigator title="电表列表" canBack="{{true}}" />
|
||||
<table header="{{header}}" list="{{list}}" />
|
1
pages/meterList/index.wxss
Normal file
1
pages/meterList/index.wxss
Normal file
@ -0,0 +1 @@
|
||||
/* pages/meterList/index.wxss */
|
Loading…
x
Reference in New Issue
Block a user