Compare commits
115 Commits
5147843266
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 17c992fb0b | |||
| 493be62f44 | |||
| af749eb638 | |||
| 3340f1f3af | |||
| cdbc3fa959 | |||
| b1cca8f8a5 | |||
| 70737fa2b8 | |||
| 71ad4995c8 | |||
| 3e640c3633 | |||
| a8312b89d5 | |||
| f0dee5bc77 | |||
| 7bc344e90b | |||
| 5f56f9a6a8 | |||
| 886a03cf16 | |||
| fccaee5f2b | |||
| 33d7528990 | |||
| f9aedf7d79 | |||
| ac0a4b02c7 | |||
| 7bd4da3c84 | |||
| a36faa9bcb | |||
| 7772b3de1a | |||
| 10a0fd7c19 | |||
| d27fa31ac7 | |||
| a3c4e78c22 | |||
| 5c202e99a6 | |||
| e637bbf8a8 | |||
| 4d665588ac | |||
| 028d695deb | |||
| 3e9857bdcd | |||
| 34995ef9a3 | |||
| fb9e727efd | |||
| 721937fa5b | |||
| 32b7dbc38c | |||
| 1b69035ed2 | |||
| fc5ef4b931 | |||
| 8478e324d8 | |||
| d58436ef5f | |||
| 5fbd34d9f8 | |||
| edcaa7701c | |||
| 902b4726c6 | |||
| 71194fbf1c | |||
| 28c4028893 | |||
| 1a3b94af51 | |||
| 8a1af13924 | |||
| db4045031a | |||
| d6e93d9f36 | |||
| 93ee759092 | |||
| b078bbf26a | |||
| 16a03fbb4b | |||
| 5d617f2282 | |||
| 616c6a53fb | |||
| 103c10347c | |||
| 24f2ec9ead | |||
| 2b653ea3ed | |||
| b905da6035 | |||
| ec77d26c27 | |||
| 293a5c8682 | |||
| bcaefbe1cb | |||
| 4ecf443f89 | |||
| 399ef43d07 | |||
| b3358ef4ec | |||
| f63b2f3319 | |||
| 307be86cb4 | |||
| ebc8cae3c8 | |||
| f6f1425cf5 | |||
| fd7777e4f4 | |||
| 9bc3cb5584 | |||
| 34c2cb76e7 | |||
| f6d44a6d33 | |||
| a164ec227b | |||
| 3ad21ea708 | |||
| 520f44a25f | |||
| 7bbe58a0d0 | |||
| 6af35a4632 | |||
| cfad35ec52 | |||
| 883461c852 | |||
| 84c6c54e58 | |||
| efe3d3241d | |||
| c8649288ff | |||
| b9d1ee34a7 | |||
| 08ef87ce33 | |||
| 58b945eb72 | |||
| 1bb3d6dddb | |||
| e94051f7c9 | |||
| cb58d3b439 | |||
| f00bcbe8d1 | |||
| 26ec060327 | |||
| 0522d517e0 | |||
| 3f6a12ee67 | |||
| b4438b4638 | |||
| 5c971ef2e8 | |||
| 86ca43d214 | |||
| 37c8d6560f | |||
| 3def3bf68b | |||
| 7d81e7d4d5 | |||
| 8482453da0 | |||
| 6e2608925c | |||
| 95f2b2ea1b | |||
| 97962a6c8c | |||
| 927b7a6470 | |||
| 9a6c4d30f4 | |||
| b990456593 | |||
| 17a72fd674 | |||
| 2c952e71a3 | |||
| 75dab4b1ac | |||
| 2262031abd | |||
| 600041d272 | |||
| 5eb2fc8405 | |||
| 86c1166dcd | |||
| b9e1b06d29 | |||
| 31f116d331 | |||
| cf7756dd5c | |||
| f1358c2315 | |||
| 686418377e | |||
| d6aecd3066 |
21
app.js
@@ -1,14 +1,31 @@
|
||||
import { checkUpgrade, getConfigByEnv } from "./utils/index"
|
||||
|
||||
// app.js
|
||||
function share() {
|
||||
wx.onAppRoute(function(res) {
|
||||
const pages = getCurrentPages()
|
||||
const view = pages[pages.length - 1];
|
||||
if (view) {
|
||||
wx.showShareMenu()
|
||||
view.onShareAppMessage = () => {
|
||||
return {
|
||||
title: "",
|
||||
path: "/pages/home/index",
|
||||
imageUrl: "/assets/images/share.png"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
App({
|
||||
onShow() {
|
||||
checkUpgrade();
|
||||
},
|
||||
onLaunch() {
|
||||
share()
|
||||
const { api } = getConfigByEnv();
|
||||
this.globalData = { ...this.globalData, api, }
|
||||
|
||||
},
|
||||
globalData: {
|
||||
primaryColor: '#52c41a'
|
||||
|
||||
22
app.json
@@ -14,11 +14,29 @@
|
||||
"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",
|
||||
"pages/workBench/index",
|
||||
"pages/webPage/index",
|
||||
"pages/aid/finance/index",
|
||||
"pages/aid/law/index",
|
||||
"pages/aid/detail/index",
|
||||
"pages/aid/consult/index",
|
||||
"pages/writeReading/index",
|
||||
"pages/readingHistory/index",
|
||||
"pages/integral/index",
|
||||
"pages/discountCoupon/index",
|
||||
"pages/integralRecord/index",
|
||||
"pages/meterList/index",
|
||||
"pages/workBench/components/tenement/components/createTenement/index",
|
||||
"pages/billMeterDetail/index",
|
||||
"pages/meterBalanceRecord/index"
|
||||
],
|
||||
"subPackages": [
|
||||
{
|
||||
|
||||
BIN
assets/images/baike.png
Normal file
|
After Width: | Height: | Size: 28 KiB |
BIN
assets/images/finance.png
Normal file
|
After Width: | Height: | Size: 23 KiB |
BIN
assets/images/law.png
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
assets/images/share.png
Normal file
|
After Width: | Height: | Size: 169 KiB |
BIN
assets/images/stop.png
Normal file
|
After Width: | Height: | Size: 5.4 KiB |
BIN
assets/images/tihuan.png
Normal file
|
After Width: | Height: | Size: 434 KiB |
BIN
assets/tabbar/special.png
Normal file
|
After Width: | Height: | Size: 10 KiB |
BIN
assets/tabbar/special_select.png
Normal file
|
After Width: | Height: | Size: 10 KiB |
@@ -1,9 +1,12 @@
|
||||
import { getReportDetail } from "../../../service/report";
|
||||
import { alertInfo, getPixelRatio } from "../../../utils/index";
|
||||
import { alertInfo, alertSuccess, getPixelRatio, loadingFunc } from "../../../utils/index";
|
||||
import request from '../../../utils/request'
|
||||
import * as echarts from '../../components/echarts/echarts';
|
||||
import { getRoundNumber } from "../../../utils/index"
|
||||
const { OK } = request
|
||||
|
||||
|
||||
|
||||
// pages/billDetail/index.js
|
||||
Page({
|
||||
|
||||
@@ -15,42 +18,53 @@ Page({
|
||||
time: "",
|
||||
detail: {},
|
||||
meters: [],
|
||||
header1: [
|
||||
{ key: 'address', title: '电表地址' },
|
||||
{ title: '起码',renderBody: (item) => { return item?.startNumber } },
|
||||
{ title: '止码',renderBody: (item) => { return item?.endNumber } },
|
||||
{ title: '倍率',renderBody: (item) => { return item?.displayRatio } },
|
||||
],
|
||||
header2: [
|
||||
{ title: '用电量', renderBody: (item) => item?.overall?.amount },
|
||||
{ title: '线损电量',renderBody: (item) => item?.loss?.amount },
|
||||
{ title: '公摊电量',renderBody: (item) => item?.publicAmount },
|
||||
{ title: '合计电量',renderBody: (item) => {
|
||||
// header1: [
|
||||
// { key: 'address', title: '电表地址' },
|
||||
// { title: '起码',renderBody: (item) => { return item?.startNumber } },
|
||||
// { title: '止码',renderBody: (item) => { return item?.endNumber } },
|
||||
// { title: '倍率',renderBody: (item) => { return item?.displayRatio } },
|
||||
// ],
|
||||
// header2: [
|
||||
// { title: '用电量', renderBody: (item) => item?.overall?.amount },
|
||||
// { title: '线损电量',renderBody: (item) => item?.loss?.amount },
|
||||
// { title: '公摊电量',renderBody: (item) => item?.publicAmount },
|
||||
// { title: '合计电量',renderBody: (item) => {
|
||||
|
||||
} },
|
||||
]
|
||||
// } },
|
||||
// ]
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
const { id = "R00053677580943361", time = "2023-10" } = options;
|
||||
this.init(id, time);
|
||||
const { id, time, tenement } = options;
|
||||
const that = this;
|
||||
loadingFunc(async () => {
|
||||
await that.init(id, time, tenement);
|
||||
})
|
||||
},
|
||||
async init(id, time) {
|
||||
const { code, message, detail } = await getReportDetail(id)
|
||||
async init(id, time, tenement) {
|
||||
const { code, message, detail, amount } = await getReportDetail(id, tenement)
|
||||
if (code !== OK) {
|
||||
alertInfo(message)
|
||||
return;
|
||||
}
|
||||
this.setData({
|
||||
id, time, detail, 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)
|
||||
id,
|
||||
time,
|
||||
detail,
|
||||
amount: amount,
|
||||
meters: detail?.meters?.map(item => {
|
||||
if (item?.loss?.amount) {
|
||||
item.loss.amount = getRoundNumber(Number(item.loss.amount))
|
||||
}
|
||||
// const finalAmount = Number(item?.overall?.amount || 0) + Number(item?.loss?.amount || 0) + Number(item?.publicAmount || 0)
|
||||
item.finalAmount = getRoundNumber(Number(item.finalAmount))
|
||||
return item;
|
||||
})
|
||||
})
|
||||
if (detail?.park?.meter04kvType === 0) {
|
||||
const option = {
|
||||
tooltip: {
|
||||
trigger: 'item'
|
||||
@@ -77,14 +91,57 @@ 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)' } },
|
||||
|
||||
],
|
||||
}
|
||||
]
|
||||
};
|
||||
this.init_pieCharts(option);
|
||||
} else {
|
||||
// const option = {
|
||||
// tooltip: {
|
||||
// trigger: 'item'
|
||||
// },
|
||||
// legend: {
|
||||
// top: 10,
|
||||
// left: 'center'
|
||||
// },
|
||||
// label: {
|
||||
// alignTo: 'edge',
|
||||
// formatter: '{name|{b}}\n{value|{c} }',
|
||||
// minMargin: 5,
|
||||
// edgeDistance: 10,
|
||||
// lineHeight: 15,
|
||||
// rich: {
|
||||
// time: {
|
||||
// fontSize: 10,
|
||||
// color: '#999'
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
// series: [
|
||||
// {
|
||||
// type: 'pie',
|
||||
// radius: '50%',
|
||||
// data: [
|
||||
// {
|
||||
// value: detail.comprehensive.lossAmount,
|
||||
// name: '线损电量',
|
||||
// },
|
||||
// {
|
||||
// value: detail.comprehensive.consumption,
|
||||
// name: '电度电量',
|
||||
// },
|
||||
|
||||
// ],
|
||||
// }
|
||||
// ]
|
||||
// };
|
||||
// this.init_pieCharts(option);
|
||||
}
|
||||
|
||||
const that = this;
|
||||
wx.getSystemInfo({
|
||||
success: function (res) {
|
||||
@@ -111,6 +168,12 @@ Page({
|
||||
return pieChart;
|
||||
});
|
||||
},
|
||||
jumpToDetail(e) {
|
||||
const { meter } = e.currentTarget.dataset;
|
||||
wx.navigateTo({
|
||||
url: '/pages/billMeterDetail/index?data=' + JSON.stringify(meter),
|
||||
})
|
||||
},
|
||||
download() {
|
||||
const { id: tenement } = wx.getStorageSync('tenement')
|
||||
const { id } = this.data;
|
||||
@@ -130,18 +193,27 @@ Page({
|
||||
case 'develop':
|
||||
wx.setClipboardData({
|
||||
data: `http://1.92.72.5:8080/user-report/?report=${id}&tenement=${tenement}`,
|
||||
success: () => {
|
||||
alertSuccess("复制成功")
|
||||
}
|
||||
})
|
||||
break;
|
||||
// 体验版
|
||||
case 'trial':
|
||||
wx.setClipboardData({
|
||||
data: `http://1.92.72.5:8080/user-report/?report=${id}&tenement=${tenement}`,
|
||||
success: () => {
|
||||
alertSuccess("复制成功")
|
||||
}
|
||||
})
|
||||
break;
|
||||
// 正式版
|
||||
case 'release':
|
||||
wx.setClipboardData({
|
||||
data: `https://zgd.hbhcbn.com/user-report/?report=${id}&tenement=${tenement}`,
|
||||
success: () => {
|
||||
alertSuccess("复制成功")
|
||||
}
|
||||
})
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
</view>
|
||||
<view class="address">
|
||||
<view class="label">
|
||||
用电地址:
|
||||
商户地址:
|
||||
</view>
|
||||
<view class="value"> {{ detail.tenement.address }} </view>
|
||||
</view>
|
||||
@@ -25,14 +25,14 @@
|
||||
<van-button type="info" size="small" class="download" bind:click="download">下载</van-button>
|
||||
</view>
|
||||
|
||||
<view class="wrapper">
|
||||
<view class="wrapper" wx:if="{{detail.park.meter04kvType !== 1}}">
|
||||
<view class="line"></view>
|
||||
<view class="contentTitle"> 本期账单 </view>
|
||||
<van-row gutter="10">
|
||||
<van-col span="8">
|
||||
<view class="colContent">
|
||||
<view class="colContentTitle">本期用电量</view>
|
||||
<view class="colContentValue"> {{ detail.comprehensive.consumption }} 千瓦时 </view>
|
||||
<view class="colContentValue" wx:if="{{detail.park.meter04kvType === 0}}"> {{ amount }} 千瓦时 </view>
|
||||
</view>
|
||||
</van-col>
|
||||
<van-col span="8">
|
||||
@@ -50,17 +50,10 @@
|
||||
</van-row>
|
||||
<view class="line"></view>
|
||||
<view class="contentTitle"> 电费构成 </view>
|
||||
<echarts
|
||||
style="width:200rpx;height:180rpx;"
|
||||
id="echarts"
|
||||
class='mychart-bar'
|
||||
canvas-id="mychart-bar"
|
||||
ec="{{ ec }}"
|
||||
forceUseOldCanvas="{{false}}"
|
||||
>
|
||||
<echarts style="width:200rpx;height:180rpx;" id="echarts" class='mychart-bar' canvas-id="mychart-bar" ec="{{ ec }}" forceUseOldCanvas="{{false}}">
|
||||
</echarts>
|
||||
<view class="tooltip">
|
||||
(本月电量+本月线损电量)*电单价+摊薄公摊电费+摊薄调整电费
|
||||
(电度电量+线损电量)*电单价+摊薄公摊电费+摊薄调整电费
|
||||
</view>
|
||||
<view class="line"></view>
|
||||
<view class="contentTitle"> 电量明细 </view>
|
||||
@@ -81,12 +74,12 @@
|
||||
</van-col>
|
||||
<van-col span="6">
|
||||
<view class="tableTitle"> 倍率 </view>
|
||||
<view class="tableContent"> {{item.displayRatio}} </view>
|
||||
<view class="tableContent"> {{item.ratio}} </view>
|
||||
</van-col>
|
||||
</van-row>
|
||||
<van-row>
|
||||
<van-col span="6">
|
||||
<view class="tableTitle"> 用电量 </view>
|
||||
<view class="tableTitle"> 电度电量 </view>
|
||||
<view class="tableContent"> {{item.overall.amount}} </view>
|
||||
|
||||
</van-col>
|
||||
@@ -106,4 +99,97 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="wrapper" wx:if="{{detail.park.meter04kvType === 1}}">
|
||||
<view class="line"></view>
|
||||
<view class="contentTitle"> 本期账单 </view>
|
||||
<van-row gutter="10">
|
||||
<van-col span="12">
|
||||
<view class="colContent">
|
||||
<view class="colContentTitle">本期用电量</view>
|
||||
<view class="colContentValue"> {{ detail.comprehensive.finalAmount }} 千瓦时 </view>
|
||||
</view>
|
||||
</van-col>
|
||||
<van-col span="12">
|
||||
<view class="colContent">
|
||||
<view class="colContentTitle">本期电费</view>
|
||||
<view class="colContentValue"> {{ detail.comprehensive.total }} 元 </view>
|
||||
</view>
|
||||
</van-col>
|
||||
</van-row>
|
||||
<view class="line"></view>
|
||||
<view class="contentTitle"> 分时明细 </view>
|
||||
<van-row gutter="10">
|
||||
<van-col span="12">
|
||||
<view class="colContent">
|
||||
<view class="colContentTitle">
|
||||
分时电量
|
||||
<view> (千瓦时) </view>
|
||||
</view>
|
||||
<view class="colContentValue2">尖: {{ detail.comprehensive.sharpAmount }} </view>
|
||||
<view class="colContentValue2">峰: {{ detail.comprehensive.peakAmount }} </view>
|
||||
<view class="colContentValue2">平: {{ detail.comprehensive.flatAmount }} </view>
|
||||
<view class="colContentValue2">谷: {{ detail.comprehensive.valleyAmount }} </view>
|
||||
</view>
|
||||
</van-col>
|
||||
<van-col span="12">
|
||||
<view class="colContent">
|
||||
<view class="colContentTitle">
|
||||
分时单价
|
||||
<view> (元/千瓦时) </view>
|
||||
</view>
|
||||
<view class="colContentValue2">尖: {{ detail.comprehensive.priceSharp }} </view>
|
||||
<view class="colContentValue2">峰: {{ detail.comprehensive.pricePeak }} </view>
|
||||
<view class="colContentValue2">平: {{ detail.comprehensive.priceFlat }} </view>
|
||||
<view class="colContentValue2">谷: {{ detail.comprehensive.priceValley }} </view>
|
||||
</view>
|
||||
</van-col>
|
||||
</van-row>
|
||||
<view class="line"></view>
|
||||
<view class="tooltip">
|
||||
(电度电量+线损电量)*单价+摊薄公摊电费+摊薄调整电费
|
||||
</view>
|
||||
<view class="line"></view>
|
||||
<view class="contentTitle"> 分时电量明细 </view>
|
||||
<view class="tableWrapper">
|
||||
<view class="meterListItem" wx:for="{{meters}}" wx:key="id">
|
||||
<div class="top">
|
||||
<view class="address">{{item.address}}</view>
|
||||
<view class="detail primaryTextBtn" bind:tap="jumpToDetail" data-meter="{{item}}"> 详情 </view>
|
||||
</div>
|
||||
<view style="margin: 20rpx 0; background-color: #fff;">
|
||||
<van-row custom-style="height: 100%;display: flex;flex-direction: column;overflow: hidden;">
|
||||
<van-col span="6">
|
||||
<view class="tableTitle"> 电度电量 </view>
|
||||
</van-col>
|
||||
<van-col span="6">
|
||||
<view class="tableTitle"> 线损电量 </view>
|
||||
</van-col>
|
||||
<van-col span="6">
|
||||
<view class="tableTitle"> 合计电量 </view>
|
||||
</van-col>
|
||||
<van-col span="6">
|
||||
<view class="tableTitle"> 合计电费 </view>
|
||||
</van-col>
|
||||
</van-row>
|
||||
<van-row class="meterListItemContent">
|
||||
<van-col span="6">
|
||||
<view class="tableContent"> {{item.overall.amount}} </view>
|
||||
</van-col>
|
||||
|
||||
<van-col span="6">
|
||||
<view class="tableContent"> {{item.loss.amount}} </view>
|
||||
</van-col>
|
||||
|
||||
<van-col span="6">
|
||||
<view class="tableContent"> {{item.finalAmount}} </view>
|
||||
</van-col>
|
||||
|
||||
<van-col span="6">
|
||||
<view class="tableContent"> {{item.finalTotal}} </view>
|
||||
</van-col>
|
||||
</van-row>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view style="height: 20rpx;"></view>
|
||||
@@ -6,7 +6,7 @@
|
||||
display: flex;
|
||||
align-items: center;
|
||||
position: sticky;
|
||||
z-index: 999 !important;
|
||||
z-index: 999999 !important;
|
||||
}
|
||||
|
||||
.titleContent {
|
||||
@@ -59,12 +59,25 @@ page {
|
||||
text-align: center;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.colContentTitle2 {
|
||||
padding: 30rpx 0;
|
||||
text-align: center;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.colContentValue {
|
||||
padding-bottom: 30rpx;
|
||||
text-align: center;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.colContentValue2 {
|
||||
padding-bottom: 20rpx;
|
||||
padding-left: 40rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.tooltip {
|
||||
font-size: 30rpx;
|
||||
color: rgb(136, 132, 132);
|
||||
@@ -87,6 +100,7 @@ page {
|
||||
background-color: #fff;
|
||||
box-sizing: border-box;
|
||||
flex: 1;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.download {
|
||||
@@ -94,3 +108,29 @@ page {
|
||||
top: 20rpx;
|
||||
right: 20rpx;
|
||||
}
|
||||
|
||||
.meterListItem {
|
||||
font-size: 32rpx;
|
||||
}
|
||||
|
||||
.meterListItem .top {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.meterListItem .address {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
|
||||
/* .top .meterListItem:nth-child(even) .tableContent,
|
||||
.bottom .meterListItem:nth-child(even) .tableContent,
|
||||
.top .meterListItem:nth-child(even),
|
||||
.bottom .meterListItem:nth-child(even)
|
||||
{
|
||||
|
||||
} */
|
||||
|
||||
.meterListItemContent, .meterListItemContent .tableContent {
|
||||
background-color: #fff;
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
// pages/electricQuery/components/accountingCard/index.js
|
||||
Component({
|
||||
|
||||
/**
|
||||
* 组件的属性列表
|
||||
*/
|
||||
|
||||
@@ -1,33 +1,86 @@
|
||||
<!--pages/electricQuery/components/accountingCard/index.wxml-->
|
||||
<view class="wrapper">
|
||||
<view class="title">
|
||||
{{data.meter.address}}
|
||||
<span>{{data.meter.address}}</span>
|
||||
<span style="font-size: 30rpx; margin-left: 100rpx;">电表编号:{{data.meter.sn}}</span>
|
||||
</view>
|
||||
<van-row>
|
||||
<van-col span="6">
|
||||
<view class="table-header" style="border-bottom: 2rpx solid #000; ">
|
||||
<view class="table-header-row">
|
||||
<text class="table-header-cell">类目</text>
|
||||
<text class="table-header-cell">金额</text>
|
||||
<text class="table-header-cell">更新时间</text>
|
||||
</view>
|
||||
</view>
|
||||
</van-row>
|
||||
|
||||
<view style="border-bottom: 2rpx solid rgba(12, 236, 188, 0.26); ">
|
||||
<van-row>
|
||||
<van-col span="7">
|
||||
<view class="tableTitle"> 初始余额 </view>
|
||||
</van-col>
|
||||
<van-col span="7">
|
||||
<view class="tableTitle"> 储值累计金额 </view>
|
||||
</van-col>
|
||||
<van-col span="5">
|
||||
<view class="tableTitle"> 电费 </view>
|
||||
</van-col>
|
||||
<van-col span="6">
|
||||
<view class="tableTitle"> 账务余额 </view>
|
||||
</van-col>
|
||||
<van-col span="6">
|
||||
<van-col span="10">
|
||||
<view class="tableContent"> {{data.startMoney}} </view>
|
||||
</van-col>
|
||||
<van-col span="7">
|
||||
<view class="tableContent"> {{data.rechargeMoney}} </view>
|
||||
</van-col>
|
||||
<van-col span="5">
|
||||
<view class="tableContent"> {{data.electricMoney}} </view>
|
||||
</van-col>
|
||||
<van-col span="6">
|
||||
<view class="tableContent"> {{data.currentMoney}} </view>
|
||||
<view calss="tableContent"> {{data.updateStartMoneyAt || '--'}} </view>
|
||||
</van-col>
|
||||
</van-row>
|
||||
</view>
|
||||
|
||||
<view style="border-bottom: 2rpx solid rgba(12, 236, 188, 0.26); ">
|
||||
<van-row>
|
||||
<van-col span="7">
|
||||
<view class="tableTitle"> 累计充值金额 </view>
|
||||
</van-col>
|
||||
<van-col span="10">
|
||||
<view class="tableContent"> {{data.rechargeMoney}} </view>
|
||||
</van-col>
|
||||
<van-col span="7">
|
||||
<view calss="tableContent"> {{data.updateRechargeMoneyAt || '--'}} </view>
|
||||
</van-col>
|
||||
</van-row>
|
||||
</view>
|
||||
|
||||
<view style="border-bottom: 2rpx solid rgba(12, 236, 188, 0.26); ">
|
||||
<van-row>
|
||||
<van-col span="7">
|
||||
<view class="tableTitle"> 电费 </view>
|
||||
</van-col>
|
||||
<van-col span="10">
|
||||
<view class="tableContent"> {{data.electricMoney}} </view>
|
||||
</van-col>
|
||||
<van-col span="7">
|
||||
<view calss="tableContent"> {{data.updateElectricMoneyAt || '--'}} </view>
|
||||
</van-col>
|
||||
</van-row>
|
||||
</view>
|
||||
|
||||
<view style="border-bottom: 2rpx solid rgba(12, 236, 188, 0.26); ">
|
||||
<van-row>
|
||||
<van-col span="7">
|
||||
<view class="tableTitle"> 账务余额 </view>
|
||||
</van-col>
|
||||
<van-col span="10">
|
||||
<view class="tableContent"> {{data.accountMoney}} </view>
|
||||
</van-col>
|
||||
<van-col span="7">
|
||||
<view calss="tableContent"> {{data.updateAccountMoneyAt || '--'}} </view>
|
||||
</van-col>
|
||||
</van-row>
|
||||
</view>
|
||||
|
||||
<view style="border-bottom: 2rpx solid rgba(12, 236, 188, 0.26); ">
|
||||
<van-row>
|
||||
<van-col span="7">
|
||||
<view class="tableTitle"> 电表余额 </view>
|
||||
</van-col>
|
||||
<van-col span="10">
|
||||
<view class="tableContent"> {{data.meterMoney}} </view>
|
||||
</van-col>
|
||||
<van-col span="7">
|
||||
<view calss="tableContent"> {{data.updateMeterMoneyAt || '--'}} </view>
|
||||
</van-col>
|
||||
</van-row>
|
||||
</view>
|
||||
</view>
|
||||
@@ -17,8 +17,25 @@
|
||||
}
|
||||
|
||||
.tableContent {
|
||||
margin-top: 10rpx;
|
||||
margin-top: 25rpx;
|
||||
margin-bottom: 20rpx;
|
||||
text-align: center;
|
||||
font-size: 32rpx;
|
||||
}
|
||||
.table-header {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
background-color: #f5f5f5;
|
||||
border-bottom: 1rpx solid #eaeaea;
|
||||
}
|
||||
.table-header-row {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
}
|
||||
.table-header-cell {
|
||||
flex: 1;
|
||||
text-align: center;
|
||||
padding: 20rpx 0;
|
||||
font-size: 25rpx;
|
||||
color: #333;
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
// childPackage/pages/electricQuery/components/listTable/index.js
|
||||
Component({
|
||||
|
||||
/**
|
||||
* 组件的属性列表
|
||||
*/
|
||||
properties: {
|
||||
list: {
|
||||
type: Array,
|
||||
},
|
||||
header: Array,
|
||||
totalPage: Number,
|
||||
},
|
||||
observers: {
|
||||
'list': function(val) {
|
||||
this.setData({
|
||||
tempList: (this.data.list || [])?.slice(0, 20),
|
||||
page: 1,
|
||||
})
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 组件的初始数据
|
||||
*/
|
||||
data: {
|
||||
page: 1,
|
||||
tempList: [],
|
||||
},
|
||||
lifetimes: {
|
||||
attached() {
|
||||
this.setData({
|
||||
tempList: (this.data.list || [])?.slice(0, 20),
|
||||
})
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 组件的方法列表
|
||||
*/
|
||||
methods: {
|
||||
async onChangePage(e) {
|
||||
const page = e.detail.currentIndex;
|
||||
const that = this;
|
||||
this.setData({
|
||||
page,
|
||||
tempList: (this.data.list || [])?.slice((page - 1) * 20, page * 20)
|
||||
})
|
||||
},
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"table": "/components/table/table",
|
||||
"empty": "/components/empty/index",
|
||||
"pagination": "/components/pagination/index"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<!--childPackage/pages/electricQuery/components/listTable/index.wxml-->
|
||||
|
||||
<view wx:if="{{list.length}}">
|
||||
<table header="{{header}}" list="{{tempList}}" />
|
||||
<pagination
|
||||
currentIndex="{{page}}"
|
||||
totalPage="{{totalPage}}"
|
||||
bind:pagingChange="onChangePage"
|
||||
/>
|
||||
</view>
|
||||
<empty bind:refresh="init" wx:else />
|
||||
@@ -0,0 +1 @@
|
||||
/* childPackage/pages/electricQuery/components/listTable/index.wxss */
|
||||
128
childPackage/pages/electricQuery/components/reading/index.js
Normal file
@@ -0,0 +1,128 @@
|
||||
// childPackage/pages/electricQuery/components/reading/index.js
|
||||
import { exportElectricityList, getAccountingList, getElectricityList, getMeterReadingList } from "../../../../../service/accounting";
|
||||
import { getTenementMeterList } from "../../../../../service/meter";
|
||||
import dayjs from "../../../../../utils/dayjs";
|
||||
import { getParkInfoByTime } from "../../../../../service/park";
|
||||
import request from '../../../../../utils/request';
|
||||
import { alertInfo, getPixelRatio, loadingFunc } from "../../../../../utils/index";
|
||||
const { OK } = request;
|
||||
Component({
|
||||
|
||||
/**
|
||||
* 组件的属性列表
|
||||
*/
|
||||
properties: {
|
||||
meter: String,
|
||||
parkInfo: Object,
|
||||
},
|
||||
observers: {
|
||||
'meter': function() {
|
||||
loadingFunc(async () => {
|
||||
await this.getReadingList();
|
||||
})
|
||||
},
|
||||
"parkInfo": function(newValue) {
|
||||
this.setData({ park: newValue })
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 组件的初始数据
|
||||
*/
|
||||
data: {
|
||||
readingDetailShow: false,
|
||||
readingDetail: {},
|
||||
park: {},
|
||||
meterReadingHeader: [
|
||||
{ key: 'address', title: '电表地址', renderBody: (item) => item.meter?.address },
|
||||
{ title: '倍率', key: 'ratio' },
|
||||
{ key: 'number', title: '当前表字' },
|
||||
],
|
||||
meterReadingList: [],
|
||||
yearMonthDayReading: dayjs().format("YYYY-MM-DD"),
|
||||
yearMonthDayReadingStamp: new Date().getTime(),
|
||||
readingPage: 1,
|
||||
},
|
||||
|
||||
/**
|
||||
* 组件的方法列表
|
||||
*/
|
||||
methods: {
|
||||
clickReadingTime() {
|
||||
this.setData({
|
||||
readingVisible: true
|
||||
})
|
||||
},
|
||||
async getReadingList() {
|
||||
const { meter, yearMonthDayReading, readingPage } = this.data;
|
||||
const { code, message, data, total } = await getMeterReadingList({
|
||||
id: meter,
|
||||
time: yearMonthDayReading,
|
||||
page: readingPage
|
||||
})
|
||||
if (code !== OK) {
|
||||
alertInfo(message)
|
||||
return;
|
||||
}
|
||||
this.setData({ meterReadingList: data, totalPage: Math.ceil(total / 20) })
|
||||
},
|
||||
onReadingTimeClose() {
|
||||
this.setData({ readingVisible: false })
|
||||
},
|
||||
onReadingTimeCancel() {
|
||||
this.setData({ readingVisible: false })
|
||||
},
|
||||
onReadingTimeConfirm(e) {
|
||||
const { time } = e.detail;
|
||||
|
||||
this.setData({
|
||||
yearMonthDayReading: time,
|
||||
yearMonthDayReadingStamp: new Date(time).getTime(),
|
||||
readingVisible: false,
|
||||
readingPage: 1,
|
||||
}, () => {
|
||||
loadingFunc(async () => {
|
||||
await this.getParkInfo(time)
|
||||
await this.getReadingList();
|
||||
})
|
||||
})
|
||||
|
||||
},
|
||||
async getParkInfo(time) {
|
||||
const park = wx.getStorageSync('park');
|
||||
const { park:parkInfo, code, message } = await getParkInfoByTime(park?.id, `${time}`, `${0}`,)
|
||||
if (code !== OK) {
|
||||
alertInfo(message)
|
||||
return;
|
||||
}
|
||||
const that = this;
|
||||
return new Promise((resolve) => {
|
||||
|
||||
that.setData({
|
||||
parkInfo: parkInfo
|
||||
}, () => {
|
||||
resolve()
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
},
|
||||
showDetail(e) {
|
||||
const { index, data = {} } = e.detail;
|
||||
this.setData({
|
||||
readingDetailShow: true,
|
||||
readingDetail: data || {}
|
||||
})
|
||||
},
|
||||
async onChangePage(e) {
|
||||
const page = e.detail.currentIndex;
|
||||
const that = this;
|
||||
this.setData({
|
||||
readingPage: page
|
||||
}, () => {
|
||||
loadingFunc(async () => {
|
||||
await that.getReadingList();
|
||||
})
|
||||
})
|
||||
},
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"custom-picker": "/components/picker/index",
|
||||
"table": "/components/table/table",
|
||||
"empty": "/components/empty/index",
|
||||
"timePicker": "/components/timePicker/index",
|
||||
"pagination": "/components/pagination/index",
|
||||
"van-dialog": "@vant/weapp/dialog/index",
|
||||
"van-field": "@vant/weapp/field/index",
|
||||
"van-icon": "@vant/weapp/icon/index"
|
||||
}
|
||||
}
|
||||
150
childPackage/pages/electricQuery/components/reading/index.wxml
Normal file
@@ -0,0 +1,150 @@
|
||||
<!--childPackage/pages/electricQuery/components/reading/index.wxml-->
|
||||
<view style="margin-left: 30rpx;">
|
||||
<view class="timeChooseWrapper">
|
||||
<view> 选择时间 </view>
|
||||
<view class="time" bind:tap="clickReadingTime">
|
||||
<view class="timeText"> {{yearMonthDayReading}} </view>
|
||||
<van-icon name="arrow-down" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view style="margin: 30rpx;">
|
||||
<view wx:if="{{meterReadingList.length}}">
|
||||
<table
|
||||
header="{{meterReadingHeader}}"
|
||||
list="{{meterReadingList}}"
|
||||
bind:onClick="showDetail"
|
||||
/>
|
||||
<pagination
|
||||
currentIndex="{{readingPage}}"
|
||||
totalPage="{{totalPage}}"
|
||||
bind:pagingChange="onChangePage"
|
||||
/>
|
||||
</view>
|
||||
|
||||
<empty bind:refresh="getReadingList" wx:else />
|
||||
</view>
|
||||
|
||||
<timePicker
|
||||
type="day"
|
||||
day="{{yearMonthDayReadingStamp}}"
|
||||
show="{{readingVisible}}"
|
||||
bind:cancel="onReadingTimeCancel"
|
||||
bind:close="onReadingTimeClose"
|
||||
bind:confirm="onReadingTimeConfirm"
|
||||
/>
|
||||
|
||||
|
||||
<van-dialog
|
||||
use-slot
|
||||
title="抄表记录详情"
|
||||
show="{{ readingDetailShow }}"
|
||||
bind:close="onClose"
|
||||
>
|
||||
<view style="margin-top: 10px;">
|
||||
<van-cell-group>
|
||||
<van-field
|
||||
value="{{ readingDetail.meter.address }}"
|
||||
border="{{ false }}"
|
||||
label="地址"
|
||||
readonly
|
||||
/>
|
||||
<van-field
|
||||
value="{{ readingDetail.meter.sn }}(SN)"
|
||||
border="{{ false }}"
|
||||
label="编号"
|
||||
readonly
|
||||
/>
|
||||
|
||||
<van-field
|
||||
value="{{ readingDetail.readAt }}"
|
||||
border="{{ false }}"
|
||||
label="时间"
|
||||
readonly
|
||||
/>
|
||||
|
||||
<van-field
|
||||
value="{{ readingDetail.ratio }}"
|
||||
border="{{ false }}"
|
||||
label="倍率"
|
||||
readonly
|
||||
/>
|
||||
|
||||
<van-field
|
||||
value="{{ readingDetail.number }}"
|
||||
border="{{ false }}"
|
||||
label="当前表字(总)"
|
||||
readonly
|
||||
/>
|
||||
|
||||
<van-field
|
||||
value="{{ readingDetail.overall }}"
|
||||
border="{{ false }}"
|
||||
label="总用电量"
|
||||
readonly
|
||||
/>
|
||||
|
||||
<van-field
|
||||
value="{{ readingDetail.sharp }}"
|
||||
border="{{ false }}"
|
||||
label="当前表字(尖)"
|
||||
readonly
|
||||
wx:if="{{park.meter04kvType === 1|| park.meter04kvType === 2}}"
|
||||
/>
|
||||
<van-field
|
||||
value="{{ readingDetail.sharpAmount }}"
|
||||
border="{{ false }}"
|
||||
label="尖用电量"
|
||||
readonly
|
||||
wx:if="{{park.meter04kvType === 1|| park.meter04kvType === 2}}"
|
||||
/>
|
||||
|
||||
<van-field
|
||||
value="{{ readingDetail.peak }}"
|
||||
border="{{ false }}"
|
||||
label="当前表字(峰)"
|
||||
readonly
|
||||
wx:if="{{park.meter04kvType === 1 || park.meter04kvType === 2}}"
|
||||
/>
|
||||
<van-field
|
||||
value="{{ readingDetail.peakAmount }}"
|
||||
border="{{ false }}"
|
||||
label="峰用电量"
|
||||
readonly
|
||||
wx:if="{{park.meter04kvType === 1|| park.meter04kvType === 2}}"
|
||||
/>
|
||||
|
||||
<van-field
|
||||
value="{{ readingDetail.flat }}"
|
||||
border="{{ false }}"
|
||||
label="当前表字(平)"
|
||||
readonly
|
||||
wx:if="{{park.meter04kvType === 1|| park.meter04kvType === 2}}"
|
||||
/>
|
||||
<van-field
|
||||
value="{{ readingDetail.flatAmount }}"
|
||||
border="{{ false }}"
|
||||
label="平用电量"
|
||||
readonly
|
||||
wx:if="{{park.meter04kvType === 1|| park.meter04kvType === 2}}"
|
||||
/>
|
||||
|
||||
<van-field
|
||||
value="{{ readingDetail.valley }}"
|
||||
border="{{ false }}"
|
||||
label="当前表字(谷)"
|
||||
readonly
|
||||
wx:if="{{park.meter04kvType === 1|| park.meter04kvType === 2}}"
|
||||
/>
|
||||
<van-field
|
||||
value="{{ readingDetail.valleyAmount }}"
|
||||
border="{{ false }}"
|
||||
label="谷用电量"
|
||||
readonly
|
||||
wx:if="{{park.meter04kvType === 1|| park.meter04kvType === 2}}"
|
||||
/>
|
||||
<view class="text">上次抄表记录起,至现在时间内的用电量</view>
|
||||
</van-cell-group>
|
||||
|
||||
</view>
|
||||
</van-dialog>
|
||||
102
childPackage/pages/electricQuery/components/reading/index.wxss
Normal file
@@ -0,0 +1,102 @@
|
||||
/* childPackage/pages/electricQuery/components/reading/index.wxss */
|
||||
|
||||
/* pages/electricQuery/index.wxss */
|
||||
page {
|
||||
background-color: var(--transparent-green);
|
||||
}
|
||||
|
||||
.queryWrapper {
|
||||
margin: 20rpx 0rpx;
|
||||
background-color: #fff;
|
||||
padding:15rpx 20rpx;
|
||||
box-sizing: border-box;
|
||||
border-radius: 20rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-size: 32rpx;
|
||||
}
|
||||
|
||||
.label {
|
||||
width: 180rpx;
|
||||
font-size: 32rpx;
|
||||
}
|
||||
|
||||
.sum {
|
||||
margin-bottom: 30rpx;
|
||||
margin-left: 30rpx;
|
||||
margin-right: 30rpx;
|
||||
padding-bottom: 50rpx;
|
||||
}
|
||||
|
||||
.query {
|
||||
margin: 20rpx 0rpx;
|
||||
}
|
||||
|
||||
.typeQueryText {
|
||||
text-align: center;
|
||||
padding: 20rpx;
|
||||
background-color: var(--light-green);
|
||||
font-size: 32rpx;
|
||||
}
|
||||
|
||||
.select {
|
||||
border: 1rpx solid #ccc;
|
||||
padding: 12rpx;
|
||||
border-radius: 12rpx;
|
||||
flex: 1;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
font-size: 30rpx;
|
||||
}
|
||||
|
||||
.timeQueryText {
|
||||
text-align: center;
|
||||
padding: 20rpx;
|
||||
background-color: rgb(242,248,246);
|
||||
font-size: 30rpx;
|
||||
}
|
||||
|
||||
.wrapper {
|
||||
margin-left: 30rpx;
|
||||
margin-right: 30rpx;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.tooltip {
|
||||
margin: 20rpx 0;
|
||||
font-size: 28rpx;
|
||||
color: rgb(97, 93, 93);
|
||||
}
|
||||
.timeChooseWrapper {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-size: 30rpx;
|
||||
}
|
||||
|
||||
.time {
|
||||
flex: 1;
|
||||
margin-left: 30rpx;
|
||||
margin-right: 30rpx;
|
||||
display: flex;
|
||||
padding: 10rpx 20rpx;
|
||||
border-radius: 12rpx;
|
||||
border: 1rpx solid #ccc;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.timeText {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.mychart-bar::after{
|
||||
content:"";
|
||||
display:block;
|
||||
clear:both
|
||||
}
|
||||
|
||||
.text{
|
||||
font-size: 28rpx;
|
||||
color: #999999;
|
||||
margin: 10rpx 0;
|
||||
text-align: center;
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
// pages/electricQuery/index.js
|
||||
import { exportElectricityList, getAccountingList, getElectricityList, getMeterReadingList } from "../../../service/accounting";
|
||||
import { getTenementMeterList } from "../../../service/meter";
|
||||
import { getParkInfoByTime } from "../../../service/park";
|
||||
import dayjs from "../../../utils/dayjs";
|
||||
import request from '../../../utils/request';
|
||||
import * as echarts from '../../components/echarts/echarts';
|
||||
@@ -22,39 +23,52 @@ Page({
|
||||
year: dayjs().format('YYYY'),
|
||||
yearMonth: dayjs().format("YYYY-MM"),
|
||||
yearMonthDay: dayjs().format("YYYY-MM-DD"),
|
||||
|
||||
yearStamp: new Date().getTime(),
|
||||
yearMonthStamp: new Date().getTime(),
|
||||
yearMonthDayStamp: new Date().getTime(),
|
||||
|
||||
|
||||
header: [
|
||||
{ key: 'address', title: '电表地址', renderBody: (item) => item.meter?.address },
|
||||
// { key: 'address', title: '电表地址', renderBody: (item) => item.meter?.address },
|
||||
{ title: '时间',renderBody: (item) => { return item.time } },
|
||||
{ key: 'number', title: '耗量' },
|
||||
],
|
||||
meterReadingHeader: [
|
||||
{ key: 'address', title: '电表地址', renderBody: (item) => item.meter?.address },
|
||||
{ title: '倍率', key: 'ratio' },
|
||||
{ key: 'number', title: '抄表记录' },
|
||||
valleyHeader: [
|
||||
// { key: 'address', title: '电表地址', renderBody: (item) => item.meter?.address },
|
||||
{ title: '时间',renderBody: (item) => { return item.time } },
|
||||
{ key: 'critical', title: '尖' },
|
||||
{ key: 'peak', title: '峰' },
|
||||
{ key: 'flat', title: '平' },
|
||||
{ key: 'valley', title: '谷' },
|
||||
],
|
||||
list: [],
|
||||
visible: false,
|
||||
meterReadingList: [],
|
||||
accountingList: [],
|
||||
electricNumber: 0,
|
||||
meterNumber: 0,
|
||||
page: 1,
|
||||
readingPage: 1,
|
||||
},
|
||||
changeQueryType(e) {
|
||||
const { type } = e.currentTarget.dataset
|
||||
this.setData({ queryType: type },() => {
|
||||
switch(type) {
|
||||
case 0:
|
||||
this.init()
|
||||
loadingFunc(async () => {
|
||||
await this.init()
|
||||
})
|
||||
break;
|
||||
case 1:
|
||||
this.getReadingList();
|
||||
break;
|
||||
// loadingFunc(async () => {
|
||||
// await this.getReadingList();
|
||||
// })
|
||||
// break;
|
||||
case 2:
|
||||
this.getAccountingBalanceList();
|
||||
loadingFunc(async () => {
|
||||
await this.getAccountingBalanceList();
|
||||
})
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -67,10 +81,14 @@ Page({
|
||||
visible: true
|
||||
})
|
||||
},
|
||||
|
||||
changeTimeType(e) {
|
||||
const { type } = e.currentTarget.dataset
|
||||
const { type } = e.currentTarget.dataset;
|
||||
const that = this;
|
||||
this.setData({ timeType: type }, () => {
|
||||
this.init()
|
||||
loadingFunc(async () => {
|
||||
await that.init()
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
@@ -78,10 +96,14 @@ Page({
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
this.init()
|
||||
loadingFunc(async () => {
|
||||
await this.getMeters()
|
||||
await this.getParkInfo()
|
||||
await this.init()
|
||||
})
|
||||
},
|
||||
async init() {
|
||||
const { queryType, timeType, meterId, year, yearMonth, yearMonthDay, page } = this.data;
|
||||
const { queryType, timeType, meterId, year, yearMonth, yearMonthDay, page, parkInfo } = this.data;
|
||||
let time;
|
||||
switch(timeType) {
|
||||
case 1:
|
||||
@@ -99,7 +121,12 @@ Page({
|
||||
alertInfo(message)
|
||||
return;
|
||||
}
|
||||
this.setData({ list: data, electricNumber: Number(electricNumber)?.toFixed(2), meterNumber: Number(meterNumber), totalPage: Math.ceil(total / 20) })
|
||||
this.setData({
|
||||
list: data,
|
||||
electricNumber: Number(electricNumber)?.toFixed(2),
|
||||
meterNumber: Number(meterNumber),
|
||||
totalPage: Math.ceil(total / 20)
|
||||
})
|
||||
if (!data?.length) {
|
||||
return;
|
||||
}
|
||||
@@ -111,6 +138,12 @@ Page({
|
||||
devicePixelRatio: getPixelRatio(),
|
||||
});
|
||||
const ids = [...new Set(data?.map(item => item?.meter?.id))]
|
||||
const point = data?.[0]?.time?.slice(-1)
|
||||
const times = [...new Set(data?.map(item => item.time))].
|
||||
map(item => Number(item.replace(point, ""))).
|
||||
sort((a, b) => a - b).
|
||||
map(ele => `${ele}${point}`.padStart(3, "0"));
|
||||
|
||||
const options = {
|
||||
tooltip: {
|
||||
trigger: 'axis'
|
||||
@@ -127,18 +160,25 @@ Page({
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
boundaryGap: false,
|
||||
data: [...new Set(data?.map(item => item.time))]
|
||||
data: times
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value'
|
||||
},
|
||||
series: ids?.map(item => {
|
||||
const element = data?.find(i => i?.meter?.id === item)
|
||||
const list = data?.filter(ele => ele?.meter?.id === item)
|
||||
const newList = [...times].map(item => {
|
||||
const exist = list.find(ele => ele.time === item)
|
||||
if (exist) {
|
||||
return Number(exist.critical)+ Number(exist.peak)+Number(exist.flat)+Number(exist.valley);
|
||||
}
|
||||
return null
|
||||
})
|
||||
return {
|
||||
name: element?.meter?.address,
|
||||
type: 'line',
|
||||
stack: 'Total',
|
||||
data: data?.filter(ele => ele?.meter?.id === item).map(item => item.number)
|
||||
data: newList
|
||||
}})
|
||||
|
||||
};
|
||||
@@ -147,15 +187,7 @@ Page({
|
||||
return pieChart;
|
||||
});
|
||||
},
|
||||
async getReadingList() {
|
||||
const { meterId } = this.data;
|
||||
const { code, message, data } = await getMeterReadingList(meterId)
|
||||
if (code !== OK) {
|
||||
alertInfo(message)
|
||||
return;
|
||||
}
|
||||
this.setData({ meterReadingList: data })
|
||||
},
|
||||
|
||||
async export() {
|
||||
loadingFunc(async () => {
|
||||
const { queryType, timeType, meterId, year, yearMonth, yearMonthDay } = this.data;
|
||||
@@ -179,6 +211,7 @@ Page({
|
||||
wx.openDocument({
|
||||
filePath: data.tempFilePath,
|
||||
fileType: ['xlsx'],
|
||||
showMenu: true,
|
||||
success() {
|
||||
},
|
||||
fail(err) {
|
||||
@@ -188,7 +221,6 @@ Page({
|
||||
})
|
||||
},
|
||||
async onChangePage(e) {
|
||||
console.log('e', e)
|
||||
const page = e.detail.currentIndex;
|
||||
const that = this;
|
||||
this.setData({
|
||||
@@ -204,7 +236,7 @@ Page({
|
||||
alertInfo(message)
|
||||
return;
|
||||
}
|
||||
this.setData({ accountingList: data })
|
||||
this.setData({ accountingList: data, totalPage: 1 })
|
||||
},
|
||||
async getMeters() {
|
||||
const { id } = wx.getStorageSync('tenement')
|
||||
@@ -213,15 +245,44 @@ Page({
|
||||
alertInfo(message)
|
||||
return;
|
||||
}
|
||||
|
||||
const first = data?.[0]
|
||||
this.setData({
|
||||
meterList: data || [],
|
||||
meterId: first?.id,
|
||||
meterAddress: first?.address,
|
||||
meterCode: first?.code,
|
||||
}, () => {
|
||||
const { queryType, } = this.data;
|
||||
switch(queryType) {
|
||||
case 1:
|
||||
loadingFunc(async () => {
|
||||
await this.getReadingList();
|
||||
})
|
||||
break;
|
||||
case 2:
|
||||
loadingFunc(async () => {
|
||||
await this.getAccountingBalanceList();
|
||||
})
|
||||
break;
|
||||
default:
|
||||
loadingFunc(async () => {
|
||||
await this.init();
|
||||
})
|
||||
break;
|
||||
}
|
||||
})
|
||||
},
|
||||
clickMeter() {
|
||||
this.setData({
|
||||
type: "meter",
|
||||
columns: [{ id: "", name: "全部", code: "" }, ...this.data.meterList.map(item => ({ id: item.id, name: `${item.code}-${item.address}`, code: item.code }))],
|
||||
columns: [
|
||||
// { id: "", name: "全部", code: "" },
|
||||
...this.data.meterList.map(item => ({
|
||||
id: item.id,
|
||||
name: `${item.code}-${item.address}`,
|
||||
code: item.code,
|
||||
address: item.address
|
||||
}))],
|
||||
show: true,
|
||||
title: "表计"
|
||||
})
|
||||
@@ -235,11 +296,12 @@ Page({
|
||||
})
|
||||
},
|
||||
onOk(e) {
|
||||
const { id, code } = e.detail.value;
|
||||
const { id, code, address } = e.detail.value;
|
||||
this.setData({
|
||||
// year: currentYear,
|
||||
meterId: id,
|
||||
meterCode: code,
|
||||
meterAddress: address,
|
||||
type: "",
|
||||
show: false,
|
||||
title: ""
|
||||
@@ -247,13 +309,20 @@ Page({
|
||||
const { queryType, } = this.data;
|
||||
switch(queryType) {
|
||||
case 1:
|
||||
this.getReadingList();
|
||||
loadingFunc(async () => {
|
||||
await this.getReadingList();
|
||||
})
|
||||
break;
|
||||
case 2:
|
||||
this.getAccountingBalanceList();
|
||||
loadingFunc(async () => {
|
||||
await this.getAccountingBalanceList();
|
||||
})
|
||||
break;
|
||||
default:
|
||||
this.init();
|
||||
loadingFunc(async () => {
|
||||
await this.init();
|
||||
})
|
||||
|
||||
break;
|
||||
}
|
||||
})
|
||||
@@ -264,26 +333,44 @@ Page({
|
||||
onTimeCancel() {
|
||||
this.setData({ visible: false })
|
||||
},
|
||||
|
||||
onTimeConfirm(e) {
|
||||
const { type, time } = e.detail;
|
||||
switch(type) {
|
||||
case "year":
|
||||
this.setData({ year: time, visible: false, }, () => {
|
||||
this.init();
|
||||
loadingFunc(async () => {
|
||||
await this.getParkInfo()
|
||||
await this.init();
|
||||
})
|
||||
});
|
||||
break;
|
||||
case "month":
|
||||
const [year, month] = time.split("-")
|
||||
this.setData({ yearMonth: time, yearMonthStamp: new Date(Number(year), Number(month) - 1, 1).getTime(), visible: false }, () => {
|
||||
this.init();
|
||||
loadingFunc(async () => {
|
||||
await this.getParkInfo()
|
||||
await this.init();
|
||||
})
|
||||
});
|
||||
break;
|
||||
case "day":
|
||||
this.setData({ yearMonthDay: time, yearMonthDayStamp: new Date(time).getTime(), visible: false }, () => {
|
||||
this.init();
|
||||
this.setData({
|
||||
yearMonthDay: time,
|
||||
yearMonthDayStamp: new Date(time).getTime(),
|
||||
visible: false,
|
||||
page: 1,
|
||||
}, () => {
|
||||
loadingFunc(async () => {
|
||||
await this.getParkInfo()
|
||||
await this.init();
|
||||
})
|
||||
})
|
||||
break;
|
||||
}
|
||||
},
|
||||
readingChangeTime(e) {
|
||||
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
@@ -296,9 +383,39 @@ Page({
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
this.getMeters()
|
||||
},
|
||||
|
||||
},
|
||||
async getParkInfo() {
|
||||
const park = wx.getStorageSync('park');
|
||||
const { timeType, yearMonthDay, yearMonth, year } = this.data;
|
||||
let time = ''
|
||||
switch(timeType) {
|
||||
case 0:
|
||||
time = yearMonthDay;
|
||||
break;
|
||||
case 1:
|
||||
time = yearMonth;
|
||||
break;
|
||||
case 2:
|
||||
time = year;
|
||||
}
|
||||
const { park:parkInfo, code, message } = await getParkInfoByTime(park?.id, `${time}`, `${timeType}`,)
|
||||
if (code !== OK) {
|
||||
alertInfo(message)
|
||||
return;
|
||||
}
|
||||
const that = this;
|
||||
return new Promise((resolve) => {
|
||||
|
||||
that.setData({
|
||||
parkInfo: parkInfo
|
||||
}, () => {
|
||||
resolve()
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
|
||||
@@ -11,7 +11,11 @@
|
||||
"timePicker": "/components/timePicker/index",
|
||||
"accountingCard": "./components/accountingCard/index",
|
||||
"pagination": "/components/pagination/index",
|
||||
"echarts": "/childPackage/components/echarts/ec-canvas"
|
||||
"echarts": "/childPackage/components/echarts/ec-canvas",
|
||||
"listTable": "./components/listTable/index",
|
||||
"van-dialog": "@vant/weapp/dialog/index",
|
||||
"van-field": "@vant/weapp/field/index",
|
||||
"reading": "./components/reading/index"
|
||||
},
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
@@ -7,7 +7,7 @@
|
||||
</view>
|
||||
<view class="select" bind:tap="clickMeter">
|
||||
<view class="selectContent">
|
||||
{{ meterCode === "" ? '全部' : meterCode }}
|
||||
{{ meterAddress === "" ? '-' : meterAddress }}
|
||||
</view>
|
||||
<van-icon name="arrow-down" />
|
||||
</view>
|
||||
@@ -30,77 +30,87 @@
|
||||
<view class="timeQuery" wx:if="{{queryType === 0}}">
|
||||
<van-row>
|
||||
<van-col span="8">
|
||||
<view class="timeQueryText" style="color: {{timeType === 0 ? '#0958d9' : '#000'}}" bind:tap="changeTimeType" data-type="{{0}}"> 日耗量 </view>
|
||||
<view class="timeQueryText" style="color: {{timeType === 0 ? '#0958d9' : '#000'}}" bind:tap="changeTimeType" data-type="{{0}}"> 日用电量 </view>
|
||||
</van-col>
|
||||
<van-col span="8">
|
||||
<view class="timeQueryText" style="color: {{timeType === 1 ? '#0958d9' : '#000'}}" bind:tap="changeTimeType" data-type="{{1}}"> 月耗量 </view>
|
||||
<view class="timeQueryText" style="color: {{timeType === 1 ? '#0958d9' : '#000'}}" bind:tap="changeTimeType" data-type="{{1}}"> 月电用量 </view>
|
||||
</van-col>
|
||||
<van-col span="8">
|
||||
<view class="timeQueryText" style="color: {{timeType === 2 ? '#0958d9' : '#000'}}" bind:tap="changeTimeType" data-type="{{2}}"> 年耗量 </view>
|
||||
<view class="timeQueryText" style="color: {{timeType === 2 ? '#0958d9' : '#000'}}" bind:tap="changeTimeType" data-type="{{2}}"> 年用电量 </view>
|
||||
</van-col>
|
||||
</van-row>
|
||||
</view>
|
||||
</view>
|
||||
<view wx:if="{{queryType === 0}}">
|
||||
<view class="tooltip">
|
||||
不包括线损电量,显示为电表实际消耗电量。仅供参考,实际能耗电量以电费账单为主。如有疑问,请联系客服。
|
||||
不包括线损电量,显示为电表实际消用电量。仅供参考,实际能用电量以电费账单为主。如有疑问,请联系客服。
|
||||
</view>
|
||||
<view class="timeChooseWrapper">
|
||||
<view> 选择时间 </view>
|
||||
<view wx:if="{{timeType === 0}}"> 选择时间 </view>
|
||||
<view wx:elif="{{timeType === 1}}"> 选择日期 </view>
|
||||
<view wx:else="{{timeType === 2}}"> 选择月份 </view>
|
||||
<view class="time" bind:tap="clickTime">
|
||||
<view class="timeText" wx:if="{{timeType === 0}}"> {{yearMonthDay}} </view>
|
||||
<view class="timeText" wx:elif="{{timeType === 1}}"> {{yearMonth}} </view>
|
||||
<view class="timeText" wx:else> {{year}} </view>
|
||||
<van-icon name="arrow-down" />
|
||||
</view>
|
||||
<van-button type="info" size="small" bind:click="export"> 导出 </van-button>
|
||||
<!-- <van-button type="info" size="small" bind:click="export"> 导出 </van-button> -->
|
||||
</view>
|
||||
</view>
|
||||
<view wx:elif="{{queryType === 1}}">
|
||||
<view class="tooltip">
|
||||
<!-- <view class="tooltip">
|
||||
显示为最新的一条抄表记录。电表更新数据有延迟,仅供参考,实际以电表上显示为准。
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
<view wx:elif="{{queryType === 2}}">
|
||||
<view class="tooltip">
|
||||
账务余额更新时间为:每次预存电费后,每次账单发布后,剩余的实际金额。电表余额与账务余额相差较大的用户,每半年统一处理一次。
|
||||
账务余额更新时间为:每次预存电费后,每次发布账单后剩余的实际金额。
|
||||
</view>
|
||||
<view class="tooltip">
|
||||
计算公式:账务余额 = 初始余额 + 累充充值金额 - 电费
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
<view wx:if="{{queryType === 0}}">
|
||||
<view style="margin: 30rpx;">
|
||||
<view wx:if="{{list.length}}">
|
||||
<!-- <view wx:if="{{list.length}}">
|
||||
<table header="{{header}}" list="{{list}}" />
|
||||
<pagination currentIndex="{{page}}" totalPage="{{totalPage}}" bind:pagingChange="onChangePage" />
|
||||
<pagination
|
||||
currentIndex="{{page}}"
|
||||
totalPage="{{totalPage}}"
|
||||
bind:pagingChange="onChangePage"
|
||||
wx:if="{{timeType === 0}}"
|
||||
/>
|
||||
</view>
|
||||
<empty bind:refresh="init" wx:else />
|
||||
<empty bind:refresh="init" wx:else /> -->
|
||||
|
||||
<listTable
|
||||
list="{{list}}"
|
||||
header="{{header}}"
|
||||
totalPage="{{totalPage}}"
|
||||
wx:if="{{parkInfo.category !== 1}}"
|
||||
/>
|
||||
<listTable
|
||||
list="{{list}}"
|
||||
header="{{valleyHeader}}"
|
||||
totalPage="{{totalPage}}"
|
||||
wx:if="{{parkInfo.category === 1}}"
|
||||
/>
|
||||
</view>
|
||||
<view class="sum">
|
||||
合计:表计数量:{{meterNumber}},耗电量:{{electricNumber}}
|
||||
合计:表计数量:{{meterNumber}},用电量:{{electricNumber}}
|
||||
</view>
|
||||
</view>
|
||||
<view wx:if="{{queryType === 1}}">
|
||||
<view style="margin: 30rpx;">
|
||||
<view wx:if="{{meterReadingList.length}}" >
|
||||
<table
|
||||
header="{{meterReadingHeader}}"
|
||||
list="{{meterReadingList}}"
|
||||
/>
|
||||
|
||||
</view>
|
||||
|
||||
<empty bind:refresh="getReadingList" wx:else />
|
||||
</view>
|
||||
|
||||
|
||||
<reading meter="{{meterId}}" parkInfo="{{parkInfo}}" bind:changeTime="readingChangeTime" />
|
||||
</view>
|
||||
<view wx:if="{{queryType === 2}}">
|
||||
<view style="margin: 30rpx;">
|
||||
<view wx:if="{{accountingList.length}}">
|
||||
<accountingCard wx:for="{{accountingList}}" data="{{item}}" />
|
||||
</view>
|
||||
<!-- <table header="{{meterReadingHeader}}" list="{{accountingList}}" wx:if="{{accountingList.length}}" /> -->
|
||||
<empty bind:refresh="getAccountingBalanceList" wx:else />
|
||||
</view>
|
||||
|
||||
@@ -112,7 +122,7 @@
|
||||
canvas-id="mychart-bar"
|
||||
ec="{{ ec }}"
|
||||
forceUseOldCanvas="{{false}}"
|
||||
wx:if="{{list.length}}"
|
||||
wx:if="{{list.length && queryType === 0}}"
|
||||
>
|
||||
</echarts>
|
||||
<custom-picker
|
||||
@@ -134,3 +144,4 @@
|
||||
bind:close="onTimeClose"
|
||||
bind:confirm="onTimeConfirm"
|
||||
/>
|
||||
|
||||
|
||||
37
components/DateTimePicker/index.js
Normal file
@@ -0,0 +1,37 @@
|
||||
// components/datePicker/index.js
|
||||
import dayjs from "../../utils/dayjs"
|
||||
|
||||
Component({
|
||||
|
||||
/**
|
||||
* 组件的属性列表
|
||||
*/
|
||||
properties: {
|
||||
show: Boolean,
|
||||
},
|
||||
|
||||
/**
|
||||
* 组件的初始数据
|
||||
*/
|
||||
data: {
|
||||
currentDate: new Date().getTime(),
|
||||
maxDate: new Date().getTime(),
|
||||
minDate: new Date(2024, 1, 1).getTime(),
|
||||
},
|
||||
lifetimes: {
|
||||
attached() {
|
||||
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 组件的方法列表
|
||||
*/
|
||||
methods: {
|
||||
onCancel() {
|
||||
this.triggerEvent("cancel")
|
||||
},
|
||||
onConfirm(e) {
|
||||
this.triggerEvent("confirm", { time: dayjs(e.detail).format("YYYY-MM-DD HH:mm:ss") })
|
||||
}
|
||||
}
|
||||
})
|
||||
7
components/DateTimePicker/index.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"van-popup": "@vant/weapp/popup/index",
|
||||
"van-datetime-picker": "@vant/weapp/datetime-picker/index"
|
||||
}
|
||||
}
|
||||
18
components/DateTimePicker/index.wxml
Normal file
@@ -0,0 +1,18 @@
|
||||
<!--components/datePicker/index.wxml-->
|
||||
|
||||
<van-popup
|
||||
show="{{ show }}"
|
||||
position="bottom"
|
||||
bind:close="onClose"
|
||||
z-index="10000"
|
||||
>
|
||||
|
||||
<van-datetime-picker
|
||||
type="datetime"
|
||||
value="{{ currentDate }}"
|
||||
min-date="{{ minDate }}"
|
||||
max-date="{{ maxDate }}"
|
||||
bind:confirm="onConfirm"
|
||||
bind:cancel="onCancel"
|
||||
/>
|
||||
</van-popup>
|
||||
1
components/DateTimePicker/index.wxss
Normal file
@@ -0,0 +1 @@
|
||||
/* components/datePicker/index.wxss */
|
||||
31
components/Segmented/index.js
Normal file
@@ -0,0 +1,31 @@
|
||||
// components/Segmented/index.js
|
||||
Component({
|
||||
|
||||
/**
|
||||
* 组件的属性列表
|
||||
*/
|
||||
properties: {
|
||||
list: Array,
|
||||
active: Number,
|
||||
},
|
||||
|
||||
/**
|
||||
* 组件的初始数据
|
||||
*/
|
||||
data: {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 组件的方法列表
|
||||
*/
|
||||
methods: {
|
||||
handleChange(e) {
|
||||
const { index } = e.currentTarget.dataset;
|
||||
if (index === this.data.active) {
|
||||
return;
|
||||
}
|
||||
this.triggerEvent("change", { index, name: this.data.list[index] })
|
||||
}
|
||||
}
|
||||
})
|
||||
12
components/Segmented/index.wxml
Normal file
@@ -0,0 +1,12 @@
|
||||
<!--components/Segmented/index.wxml-->
|
||||
<view style="margin: 10rpx 20rpx">
|
||||
<view
|
||||
wx:for="{{list}}"
|
||||
wx:key="index"
|
||||
class="item {{index === active ? 'active' : ''}}"
|
||||
bind:tap="handleChange"
|
||||
data-index="{{index}}"
|
||||
>
|
||||
{{ item }}
|
||||
</view>
|
||||
</view>
|
||||
19
components/Segmented/index.wxss
Normal file
@@ -0,0 +1,19 @@
|
||||
/* components/Segmented/index.wxss */
|
||||
.item {
|
||||
display: inline-block;
|
||||
padding: 20rpx;
|
||||
border: 1rpx solid #ccc;
|
||||
border-right: 0rpx;
|
||||
font-size: 32rpx;
|
||||
min-width: 140rpx;
|
||||
text-align: center;
|
||||
|
||||
}
|
||||
|
||||
.item:nth-last-child(1) {
|
||||
border-right: 1rpx solid #ccc;
|
||||
}
|
||||
|
||||
.active {
|
||||
background-color: var(--middle-green);
|
||||
}
|
||||
89
components/aid/index.js
Normal file
@@ -0,0 +1,89 @@
|
||||
import { getAidList } from "../../service/system";
|
||||
import { alertInfo, alertSuccess, loadingFunc } from "../../utils/index";
|
||||
import request from '../../utils/request'
|
||||
|
||||
const { OK } = request;
|
||||
|
||||
// components/aid/index.js
|
||||
Component({
|
||||
|
||||
/**
|
||||
* 组件的属性列表
|
||||
*/
|
||||
properties: {
|
||||
type: Number,
|
||||
bannerType: Number,
|
||||
|
||||
},
|
||||
lifetimes: {
|
||||
attached() {
|
||||
this.init();
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 组件的初始数据
|
||||
*/
|
||||
data: {
|
||||
park: {},
|
||||
list: [],
|
||||
total: 0,
|
||||
page: 1,
|
||||
size: 20,
|
||||
},
|
||||
lifetimes: {
|
||||
attached() {
|
||||
loadingFunc(async () => {
|
||||
await this.init();
|
||||
})
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 组件的方法列表
|
||||
*/
|
||||
methods: {
|
||||
async init() {
|
||||
const { type, page, size } = this.data;
|
||||
const { code, message, data = [], total } = await getAidList(page, size, type);
|
||||
if (code !== OK) {
|
||||
alertInfo(message)
|
||||
return
|
||||
}
|
||||
this.setData({
|
||||
list: data,
|
||||
total,
|
||||
totalPage: Math.ceil(total / size)
|
||||
})
|
||||
},
|
||||
onRefresh() {
|
||||
const that = this;
|
||||
this.setData({
|
||||
page: 1,
|
||||
}, () => {
|
||||
that.init();
|
||||
})
|
||||
},
|
||||
jumpToDetail(e) {
|
||||
const { id = "" } = e.currentTarget.dataset;
|
||||
const { type } = this.data;
|
||||
wx.navigateTo({
|
||||
url: `/pages/aid/detail/index?id=${id}&type=${type}`,
|
||||
})
|
||||
},
|
||||
consult(e) {
|
||||
const { id = "" } = e.currentTarget.dataset;
|
||||
const { type } = this.data;
|
||||
wx.navigateTo({
|
||||
url: `/pages/aid/consult/index?id=${id}&type=${type}`,
|
||||
})
|
||||
},
|
||||
async onChangePage(e) {
|
||||
const page = e.detail.currentIndex;
|
||||
const that = this;
|
||||
this.setData({
|
||||
page
|
||||
}, () => {
|
||||
that.init();
|
||||
})
|
||||
},
|
||||
}
|
||||
})
|
||||
10
components/aid/index.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"Banner": "/components/banner/index",
|
||||
"van-image": "@vant/weapp/image/index",
|
||||
"empty": "/components/empty/index",
|
||||
"van-icon": "@vant/weapp/icon/index",
|
||||
"pagination": "/components/pagination/index"
|
||||
}
|
||||
}
|
||||
36
components/aid/index.wxml
Normal file
@@ -0,0 +1,36 @@
|
||||
<!--components/aid/index.wxml-->
|
||||
<Banner park="{{park.id}}" type="{{bannerType}}" />
|
||||
<div class="title">行业精英</div>
|
||||
<view wx:if="{{list.length}}">
|
||||
<view wx:for="{{list}}" wx:key="id" >
|
||||
<view class="userInfoItem" bind:tap="jumpToDetail" data-id="{{item.id}}">
|
||||
<view class="content">
|
||||
<van-image
|
||||
width="200rpx"
|
||||
height="200rpx"
|
||||
lazy-load
|
||||
src="{{item.avatar}}"
|
||||
/>
|
||||
<view class="userInfo">
|
||||
<view style="display: flex;font-size: 30rpx;">
|
||||
<view class="userName"> {{ item.name }} </view>
|
||||
<view class="userLevel"> {{ item.level }} </view>
|
||||
</view>
|
||||
<view class="synopsis"> {{item.synopsis}}{{item.synopsis}} {{item.synopsis}} </view>
|
||||
<view class="connect" >
|
||||
<view style="display: flex; align-items: center;" catch:tap="consult" data-id="{{item.id}}">
|
||||
<van-icon name="service-o" color="#1989fa" />
|
||||
<view style="margin-left: 10rpx;color: #1989fa;"> 在线咨询 </view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<pagination
|
||||
currentIndex="{{page}}"
|
||||
totalPage="{{totalPage}}"
|
||||
bind:pagingChange="onChangePage"
|
||||
/>
|
||||
</view>
|
||||
<empty wx:else bind:refresh="onRefresh" />
|
||||
58
components/aid/index.wxss
Normal file
@@ -0,0 +1,58 @@
|
||||
/* components/aid/index.wxss */
|
||||
|
||||
.title {
|
||||
padding-top: 30rpx;
|
||||
padding-left: 30rpx;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.userInfoItem {
|
||||
padding: 30rpx;
|
||||
}
|
||||
|
||||
.userInfoItem .content {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
border-bottom: 1rpx solid #ccc;
|
||||
}
|
||||
|
||||
.userInfo {
|
||||
height: 200rpx;
|
||||
margin-left: 30rpx;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.userLevel {
|
||||
margin-left: 30rpx;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.synopsis {
|
||||
height: 75rpx;
|
||||
overflow: hidden;
|
||||
margin-top: 20rpx;
|
||||
margin-bottom: 10rpx;
|
||||
font-size: 32rpx;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
}
|
||||
|
||||
.connect {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.userName {
|
||||
width: 150rpx;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.userLevel {
|
||||
width: 250rpx;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
/* components/avatar/index.wxss */
|
||||
.wrapper {
|
||||
width: 120rpx;
|
||||
height: 120rpx;
|
||||
width: 100rpx;
|
||||
height: 100rpx;
|
||||
border-radius: 50%;
|
||||
background: radial-gradient(circle, var(--light-green), var(--middle-green),var(--deep-green) );
|
||||
display: flex;
|
||||
|
||||
74
components/banner/index.js
Normal file
@@ -0,0 +1,74 @@
|
||||
import { getBannerList } from "../../service/system"
|
||||
import { alertInfo } from "../../utils/index";
|
||||
import request from '../../utils/request'
|
||||
|
||||
const { OK } = request;
|
||||
const result = wx.getAccountInfoSync();
|
||||
const { envVersion } = result.miniProgram;
|
||||
|
||||
// pages/home/components/home-swiper/index.js
|
||||
Component({
|
||||
|
||||
/**
|
||||
* 组件的属性列表
|
||||
*/
|
||||
properties: {
|
||||
park: String,
|
||||
type: Number,
|
||||
},
|
||||
observers: {
|
||||
'park,type': function(newPark, newType) {
|
||||
if ((!newPark && newType === 0) || (!newType && newType !== 0)) {
|
||||
return
|
||||
}
|
||||
this.init(newPark, newType)
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 组件的初始数据
|
||||
*/
|
||||
data: {
|
||||
indicatorDots: true,
|
||||
vertical: false,
|
||||
autoplay: true,
|
||||
interval: 6000,
|
||||
duration: 500,
|
||||
list: [],
|
||||
},
|
||||
/**
|
||||
* 组件的方法列表
|
||||
*/
|
||||
methods: {
|
||||
async init(park, type) {
|
||||
const { code, message, data = [] } = await getBannerList(park, type);
|
||||
if (code !== OK) {
|
||||
alertInfo(message);
|
||||
this.setData({ list: [], park, type })
|
||||
return
|
||||
}
|
||||
this.setData({ list: data })
|
||||
},
|
||||
handleJump(e) {
|
||||
const { data = {} } = e.currentTarget.dataset;
|
||||
switch(data.jumpType) {
|
||||
case 1:
|
||||
wx.navigateToMiniProgram({
|
||||
appId: data.appid,
|
||||
path: data.wxPath,
|
||||
envVersion: envVersion
|
||||
})
|
||||
break;
|
||||
case 2:
|
||||
wx.navigateTo({
|
||||
url: data.value,
|
||||
})
|
||||
break;
|
||||
case 3:
|
||||
wx.navigateTo({
|
||||
url: '/pages/webPage/index?path=' + data.value,
|
||||
})
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"van-icon": "../icon/index"
|
||||
"van-image": "@vant/weapp/image/index"
|
||||
}
|
||||
}
|
||||
23
components/banner/index.wxml
Normal file
@@ -0,0 +1,23 @@
|
||||
<!--pages/home/components/home-swiper/index.wxml-->
|
||||
<swiper
|
||||
indicator-dots="{{list.length > 1}}"
|
||||
autoplay="{{autoplay}}"
|
||||
interval="{{interval}}"
|
||||
duration="{{duration}}"
|
||||
circular="{{true}}"
|
||||
wx:if="{{list.length}}"
|
||||
style="height: 288rpx"
|
||||
>
|
||||
<block wx:for="{{list}}" wx:key="id" wx:item="item">
|
||||
<swiper-item>
|
||||
<van-image
|
||||
width="100%"
|
||||
height="100%"
|
||||
lazy-load
|
||||
src="{{item.url}}"
|
||||
data-data="{{item}}"
|
||||
bind:click="handleJump"
|
||||
/>
|
||||
</swiper-item>
|
||||
</block>
|
||||
</swiper>
|
||||
1
components/banner/index.wxss
Normal file
@@ -0,0 +1 @@
|
||||
/* pages/home/components/home-swiper/index.wxss */
|
||||
76
components/discountCoupon/index.js
Normal file
@@ -0,0 +1,76 @@
|
||||
import { alertInfo, alertSuccess, loadingFunc } from "../../utils/index"
|
||||
import { redeemCoupons } from "../../service/system";
|
||||
import request from "../../utils/request"
|
||||
const { OK } = request;
|
||||
|
||||
// components/discountCoupon/index.js
|
||||
Component({
|
||||
|
||||
/**
|
||||
* 组件的属性列表
|
||||
*/
|
||||
properties: {
|
||||
type: Number,
|
||||
data: Object
|
||||
},
|
||||
|
||||
/**
|
||||
* 组件的初始数据
|
||||
*/
|
||||
data: {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 组件的方法列表
|
||||
*/
|
||||
methods: {
|
||||
handleChange() {
|
||||
const { data } = this.data;
|
||||
const that = this;
|
||||
loadingFunc(async () => {
|
||||
const { code, message } = await redeemCoupons({ id: data.id, type: 2 })
|
||||
if (code !== OK) {
|
||||
alertInfo(message)
|
||||
return
|
||||
}
|
||||
alertSuccess("兑换成功")
|
||||
that.triggerEvent("change", { id, type: 2 })
|
||||
})
|
||||
},
|
||||
showRemark() {
|
||||
wx.showModal({
|
||||
title: '备注',
|
||||
content: this.data?.data?.remark,
|
||||
showCancel: false,
|
||||
complete: (res) => {
|
||||
if (res.cancel) {
|
||||
|
||||
}
|
||||
|
||||
if (res.confirm) {
|
||||
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
},
|
||||
handleUseIt() {
|
||||
alertInfo("敬请期待")
|
||||
},
|
||||
async handleUse() {
|
||||
const { data } = this.data;
|
||||
const that = this;
|
||||
loadingFunc(async () => {
|
||||
const { code, message } = await redeemCoupons({ id: data.id, type: 2 })
|
||||
if (code !== OK) {
|
||||
alertInfo(message)
|
||||
return;
|
||||
}
|
||||
alertSuccess("领取成功")
|
||||
that.triggerEvent("get", { id, type: 1 })
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
})
|
||||
7
components/discountCoupon/index.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"van-button": "@vant/weapp/button/index",
|
||||
"van-dialog": "@vant/weapp/dialog/index"
|
||||
}
|
||||
}
|
||||
39
components/discountCoupon/index.wxml
Normal file
@@ -0,0 +1,39 @@
|
||||
<!--components/discountCoupon/index.wxml-->
|
||||
|
||||
|
||||
<view class="wrapper">
|
||||
<view class="top">
|
||||
<view class="left">
|
||||
<view class="typeText">
|
||||
<text wx:if="{{data.type === 0}}"> 通用优惠券 </text>
|
||||
<text wx:if="{{data.type === 1}}"> 无门槛优惠券 </text>
|
||||
<text wx:if="{{data.type === 2}}"> 满减券 </text>
|
||||
</view>
|
||||
<view class="time">
|
||||
有效期至 {{ data.endTime }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="right">
|
||||
<view class="price">
|
||||
<text style="font-size: 26rpx;line-height: 26rpx;"> ¥ </text>
|
||||
<view class="number" wx:if="{{data.discount > 0}}"> {{ data.discount }} 折 </view>
|
||||
<view class="number" wx:elif="{{data.discountMoney > 0}}"> {{ data.discountMoney }} 元 </view>
|
||||
<view wx:else> - </view>
|
||||
</view>
|
||||
<view class="limit">
|
||||
满 {{ data.useMin }} 可用
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="bottom">
|
||||
<view class="left" bind:tap="showRemark">
|
||||
{{data.remark}}
|
||||
</view>
|
||||
<view class="right">
|
||||
<van-button wx:if="{{type === 1}}" type="info" size="small" bind:tap="handleUse">去领取</van-button>
|
||||
<van-button wx:if="{{type === 2}}" type="info" size="small" bind:tap="handleChange">去兑换</van-button>
|
||||
<van-button wx:if="{{type === 3}}" type="info" size="small" bind:tap="handleUseIt">去使用</van-button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<van-dialog id="van-dialog" />
|
||||
60
components/discountCoupon/index.wxss
Normal file
@@ -0,0 +1,60 @@
|
||||
/* components/discountCoupon/index.wxss */
|
||||
|
||||
.wrapper {
|
||||
padding: 24rpx;
|
||||
border-radius: 16rpx;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.top {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
border-bottom: 1rpx dashed #ccc;
|
||||
padding-bottom: 30rpx;
|
||||
}
|
||||
|
||||
.top .right {
|
||||
color: #fa541c;
|
||||
}
|
||||
|
||||
.price {
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
margin-bottom: 14rpx;
|
||||
}
|
||||
|
||||
.typeText {
|
||||
font-weight: 700;
|
||||
font-size: 36rpx;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.time {
|
||||
font-size: 30rpx;
|
||||
}
|
||||
|
||||
.price {
|
||||
font-size: 44rpx;
|
||||
line-height: 44rpx;
|
||||
}
|
||||
|
||||
.limit {
|
||||
font-size: 30rpx;
|
||||
}
|
||||
|
||||
.bottom {
|
||||
margin-top: 20rpx;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.bottom .left {
|
||||
flex: 1;
|
||||
max-width: calc(100vw - 60rpx - 250rpx);
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
font-size: 30rpx;
|
||||
color: rgba(0, 0, 0, 0.7)
|
||||
}
|
||||
8
components/mp-html/index.js
Normal file
@@ -0,0 +1,8 @@
|
||||
"use strict";function e(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}/*!
|
||||
* mp-html v2.5.0
|
||||
* https://github.com/jin-yufeng/mp-html
|
||||
*
|
||||
* Released under the MIT license
|
||||
* Author: Jin Yufeng
|
||||
*/
|
||||
var t=require("./parser"),n=[];Component({data:{nodes:[]},properties:{containerStyle:String,content:{type:String,value:"",observer:function(e){this.setContent(e)}},copyLink:{type:Boolean,value:!0},domain:String,errorImg:String,lazyLoad:Boolean,loadingImg:String,pauseVideo:{type:Boolean,value:!0},previewImg:{type:null,value:!0},scrollTable:Boolean,selectable:null,setTitle:{type:Boolean,value:!0},showImgMenu:{type:Boolean,value:!0},tagStyle:Object,useAnchor:null},created:function(){this.plugins=[];for(var e=n.length;e--;)this.plugins.push(new n[e](this))},detached:function(){this._hook("onDetached")},methods:{in:function(e,t,n){e&&t&&n&&(this._in={page:e,selector:t,scrollTop:n})},navigateTo:function(t,n){var i=this;return new Promise(function(o,r){if(!i.data.useAnchor)return void r(Error("Anchor is disabled"));var a=wx.createSelectorQuery().in(i._in?i._in.page:i).select((i._in?i._in.selector:"._root")+(t?"".concat(">>>","#").concat(t):"")).boundingClientRect();i._in?a.select(i._in.selector).scrollOffset().select(i._in.selector).boundingClientRect():a.selectViewport().scrollOffset(),a.exec(function(t){if(!t[0])return void r(Error("Label not found"));var a=t[1].scrollTop+t[0].top-(t[2]?t[2].top:0)+(n||parseInt(i.data.useAnchor)||0);i._in?i._in.page.setData(e({},i._in.scrollTop,a)):wx.pageScrollTo({scrollTop:a,duration:300}),o()})})},getText:function(e){var t="";return function e(n){for(var i=0;i<n.length;i++){var o=n[i];if("text"===o.type)t+=o.text.replace(/&/g,"&");else if("br"===o.name)t+="\n";else{var r="p"===o.name||"div"===o.name||"tr"===o.name||"li"===o.name||"h"===o.name[0]&&o.name[1]>"0"&&o.name[1]<"7";r&&t&&"\n"!==t[t.length-1]&&(t+="\n"),o.children&&e(o.children),r&&"\n"!==t[t.length-1]?t+="\n":"td"!==o.name&&"th"!==o.name||(t+="\t")}}}(e||this.data.nodes),t},getRect:function(){var e=this;return new Promise(function(t,n){wx.createSelectorQuery().in(e).select("._root").boundingClientRect().exec(function(e){return e[0]?t(e[0]):n(Error("Root label not found"))})})},pauseMedia:function(){for(var e=(this._videos||[]).length;e--;)this._videos[e].pause()},setPlaybackRate:function(e){this.playbackRate=e;for(var t=(this._videos||[]).length;t--;)this._videos[t].playbackRate(e)},setContent:function(e,n){var i=this;this.imgList&&n||(this.imgList=[]),this._videos=[];var o={},r=new t(this).parse(e);if(n)for(var a=this.data.nodes.length,s=r.length;s--;)o["nodes[".concat(a+s,"]")]=r[s];else o.nodes=r;if(this.setData(o,function(){i._hook("onLoad"),i.triggerEvent("load")}),this.data.lazyLoad||this.imgList._unloadimgs<this.imgList.length/2){var l=0,c=function e(t){t&&t.height||(t={}),t.height===l?i.triggerEvent("ready",t):(l=t.height,setTimeout(function(){i.getRect().then(e).catch(e)},350))};this.getRect().then(c).catch(c)}else this.imgList._unloadimgs||this.getRect().then(function(e){i.triggerEvent("ready",e)}).catch(function(){i.triggerEvent("ready",{})})},_hook:function(e){for(var t=n.length;t--;)this.plugins[t][e]&&this.plugins[t][e]()},_add:function(e){e.detail.root=this}}});
|
||||
1
components/mp-html/index.json
Normal file
@@ -0,0 +1 @@
|
||||
{"component":true,"usingComponents":{"node":"./node/node"}}
|
||||
1
components/mp-html/index.wxml
Normal file
@@ -0,0 +1 @@
|
||||
<view class="_root {{selectable?'_select':''}}" style="{{containerStyle}}"><slot wx:if="{{!nodes[0]}}"/><node id="_root" childs="{{nodes}}" opts="{{[lazyLoad,loadingImg,errorImg,showImgMenu,selectable]}}" catchadd="_add"/></view>
|
||||
1
components/mp-html/index.wxss
Normal file
@@ -0,0 +1 @@
|
||||
._root{padding:1px 0;overflow-x:auto;overflow-y:hidden;-webkit-overflow-scrolling:touch}._select{-webkit-user-select:text;user-select:text}
|
||||
1
components/mp-html/node/node.js
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";function t(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,i)}return r}function e(e){for(var i=1;i<arguments.length;i++){var o=null!=arguments[i]?arguments[i]:{};i%2?t(Object(o),!0).forEach(function(t){r(e,t,o[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):t(Object(o)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))})}return e}function r(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}Component({data:{ctrl:{},isiOS:wx.getSystemInfoSync().system.includes("iOS")},properties:{childs:Array,opts:Array},options:{addGlobalClass:!0},attached:function(){this.triggerEvent("add",this,{bubbles:!0,composed:!0})},methods:{noop:function(){},getNode:function(t){try{for(var e=t.split("_"),r=this.data.childs[e[0]],i=1;i<e.length;i++)r=r.children[e[i]];return r}catch(t){return{text:"",attrs:{},children:[]}}},play:function(t){var r=t.target.dataset.i,i=this.getNode(r);if(this.root.triggerEvent("play",{source:i.name,attrs:e(e({},i.attrs),{},{src:i.src[this.data.ctrl[r]||0]})}),this.root.data.pauseVideo){for(var o=!1,s=t.target.id,a=this.root._videos.length;a--;)this.root._videos[a].id===s?o=!0:this.root._videos[a].pause();if(!o){var n=wx.createVideoContext(s,this);n.id=s,this.root.playbackRate&&n.playbackRate(this.root.playbackRate),this.root._videos.push(n)}}},imgTap:function(t){var e=this.getNode(t.target.dataset.i);if(e.a)return this.linkTap(e.a);if(!e.attrs.ignore&&(this.root.triggerEvent("imgtap",e.attrs),this.root.data.previewImg)){var r=this.root.imgList[e.i];wx.previewImage({showmenu:this.root.data.showImgMenu,current:r,urls:this.root.imgList})}},imgLoad:function(t){var e,i=t.target.dataset.i,o=this.getNode(i);o.w?(this.data.opts[1]&&!this.data.ctrl[i]||-1===this.data.ctrl[i])&&(e=1):e=t.detail.width,e&&this.setData(r({},"ctrl."+i,e)),this.checkReady()},checkReady:function(){var t=this;this.root.data.lazyLoad||(this.root.imgList._unloadimgs-=1,this.root.imgList._unloadimgs||setTimeout(function(){t.root.getRect().then(function(e){t.root.triggerEvent("ready",e)}).catch(function(){t.root.triggerEvent("ready",{})})},350))},linkTap:function(t){var e=t.currentTarget?this.getNode(t.currentTarget.dataset.i):{},r=e.attrs||t,i=r.href;this.root.triggerEvent("linktap",Object.assign({innerText:this.root.getText(e.children||[])},r)),i&&("#"===i[0]?this.root.navigateTo(i.substring(1)).catch(function(){}):i.split("?")[0].includes("://")?this.root.data.copyLink&&wx.setClipboardData({data:i,success:function(){return wx.showToast({title:"链接已复制"})}}):wx.navigateTo({url:i,fail:function(){wx.switchTab({url:i,fail:function(){}})}}))},mediaError:function(t){var e=t.target.dataset.i,i=this.getNode(e);if("video"===i.name||"audio"===i.name){var o=(this.data.ctrl[e]||0)+1;if(o>i.src.length&&(o=0),o<i.src.length)return this.setData(r({},"ctrl."+e,o))}else"img"===i.name&&(this.data.opts[2]&&this.setData(r({},"ctrl."+e,-1)),this.checkReady());this.root&&this.root.triggerEvent("error",{source:i.name,attrs:i.attrs,errMsg:t.detail.errMsg})}}});
|
||||
1
components/mp-html/node/node.json
Normal file
@@ -0,0 +1 @@
|
||||
{"component":true,"usingComponents":{"node":"./node"}}
|
||||
1
components/mp-html/node/node.wxml
Normal file
@@ -0,0 +1 @@
|
||||
<wxs module="isInline">var e={abbr:!0,b:!0,big:!0,code:!0,del:!0,em:!0,i:!0,ins:!0,label:!0,q:!0,small:!0,span:!0,strong:!0,sub:!0,sup:!0};module.exports=function(n,i){return e[n]||-1!==(i||"").indexOf("inline")};</wxs><template name="el"><block wx:if="{{n.name==='img'}}"><rich-text wx:if="{{n.t}}" style="display:{{n.t}}" nodes="<img class='_img' style='{{n.attrs.style}}' src='{{n.attrs.src}}'>" data-i="{{i}}" catchtap="imgTap"/><block wx:else><image wx:if="{{(opts[1]&&!ctrl[i])||ctrl[i]<0}}" class="_img" style="{{n.attrs.style}}" src="{{ctrl[i]<0?opts[2]:opts[1]}}" mode="widthFix"/><image id="{{n.attrs.id}}" class="_img {{n.attrs.class}}" style="{{ctrl[i]===-1?'display:none;':''}}width:{{ctrl[i]||1}}px;height:1px;{{n.attrs.style}}" src="{{n.attrs.src}}" mode="{{!n.h?'widthFix':(!n.w?'heightFix':(n.m||'scaleToFill'))}}" lazy-load="{{opts[0]}}" webp="{{n.webp}}" show-menu-by-longpress="{{opts[3]&&!n.attrs.ignore}}" data-i="{{i}}" bindload="imgLoad" binderror="mediaError" catchtap="imgTap" bindlongpress="noop"/></block></block><text wx:elif="{{n.text}}" user-select="{{opts[4]=='force'&&isiOS}}" decode>{{n.text}}</text><text wx:elif="{{n.name==='br'}}">\n</text><view wx:elif="{{n.name==='a'}}" id="{{n.attrs.id}}" class="{{n.attrs.href?'_a ':''}}{{n.attrs.class}}" hover-class="_hover" style="display:inline;{{n.attrs.style}}" data-i="{{i}}" catchtap="linkTap"><node childs="{{n.children}}" opts="{{opts}}" style="display:inherit"/></view><video wx:elif="{{n.name==='video'}}" id="{{n.attrs.id}}" class="{{n.attrs.class}}" style="{{n.attrs.style}}" autoplay="{{n.attrs.autoplay}}" controls="{{n.attrs.controls}}" loop="{{n.attrs.loop}}" muted="{{n.attrs.muted}}" object-fit="{{n.attrs['object-fit']}}" poster="{{n.attrs.poster}}" src="{{n.src[ctrl[i]||0]}}" data-i="{{i}}" bindplay="play" binderror="mediaError"/><audio wx:elif="{{n.name==='audio'}}" id="{{n.attrs.id}}" class="{{n.attrs.class}}" style="{{n.attrs.style}}" author="{{n.attrs.author}}" controls="{{n.attrs.controls}}" loop="{{n.attrs.loop}}" name="{{n.attrs.name}}" poster="{{n.attrs.poster}}" src="{{n.src[ctrl[i]||0]}}" data-i="{{i}}" bindplay="play" binderror="mediaError"/><rich-text wx:else id="{{n.attrs.id}}" style="{{n.f}}" user-select="{{opts[4]}}" nodes="{{[n]}}"/></template><block wx:for="{{childs}}" wx:for-item="n1" wx:for-index="i1" wx:key="i1"><template wx:if="{{!n1.c&&(!n1.children||n1.name==='a'||!isInline(n1.name,n1.attrs.style))}}" is="el" data="{{n:n1,i:''+i1,opts:opts,ctrl:ctrl}}"/><view wx:else id="{{n1.attrs.id}}" class="_{{n1.name}} {{n1.attrs.class}}" style="{{n1.attrs.style}}"><block wx:for="{{n1.children}}" wx:for-item="n2" wx:for-index="i2" wx:key="i2"><template wx:if="{{!n2.c&&(!n2.children||n2.name==='a'||!isInline(n2.name,n2.attrs.style))}}" is="el" data="{{n:n2,i:i1+'_'+i2,opts:opts,ctrl:ctrl}}"/><view wx:else id="{{n2.attrs.id}}" class="_{{n2.name}} {{n2.attrs.class}}" style="{{n2.attrs.style}}"><block wx:for="{{n2.children}}" wx:for-item="n3" wx:for-index="i3" wx:key="i3"><template wx:if="{{!n3.c&&(!n3.children||n3.name==='a'||!isInline(n3.name,n3.attrs.style))}}" is="el" data="{{n:n3,i:i1+'_'+i2+'_'+i3,opts:opts,ctrl:ctrl}}"/><view wx:else id="{{n3.attrs.id}}" class="_{{n3.name}} {{n3.attrs.class}}" style="{{n3.attrs.style}}"><block wx:for="{{n3.children}}" wx:for-item="n4" wx:for-index="i4" wx:key="i4"><template wx:if="{{!n4.c&&(!n4.children||n4.name==='a'||!isInline(n4.name,n4.attrs.style))}}" is="el" data="{{n:n4,i:i1+'_'+i2+'_'+i3+'_'+i4,opts:opts,ctrl:ctrl}}"/><view wx:else id="{{n4.attrs.id}}" class="_{{n4.name}} {{n4.attrs.class}}" style="{{n4.attrs.style}}"><block wx:for="{{n4.children}}" wx:for-item="n5" wx:for-index="i5" wx:key="i5"><template wx:if="{{!n5.c&&(!n5.children||n5.name==='a'||!isInline(n5.name,n5.attrs.style))}}" is="el" data="{{n:n5,i:i1+'_'+i2+'_'+i3+'_'+i4+'_'+i5,opts:opts,ctrl:ctrl}}"/><node wx:else id="{{n5.attrs.id}}" class="_{{n5.name}} {{n5.attrs.class}}" style="{{n5.attrs.style}}" childs="{{n5.children}}" opts="{{opts}}"/></block></view></block></view></block></view></block></view></block>
|
||||
1
components/mp-html/node/node.wxss
Normal file
@@ -0,0 +1 @@
|
||||
._a{padding:1.5px 0 1.5px 0;color:#366092;word-break:break-all}._hover{text-decoration:underline;opacity:.7}._img{max-width:100%;-webkit-touch-callout:none}._b,._strong{font-weight:700}._code{font-family:monospace}._del{text-decoration:line-through}._em,._i{font-style:italic}._h1{font-size:2em}._h2{font-size:1.5em}._h3{font-size:1.17em}._h5{font-size:.83em}._h6{font-size:.67em}._h1,._h2,._h3,._h4,._h5,._h6{display:block;font-weight:700}._ins{text-decoration:underline}._li{display:list-item}._ol{list-style-type:decimal}._ol,._ul{display:block;padding-left:40px;margin:1em 0}._q::before{content:'"'}._q::after{content:'"'}._sub{font-size:smaller;vertical-align:sub}._sup{font-size:smaller;vertical-align:super}._tbody,._tfoot,._thead{display:table-row-group}._tr{display:table-row}._td,._th{display:table-cell;vertical-align:middle}._th{font-weight:700;text-align:center}._ul{list-style-type:disc}._ul ._ul{margin:0;list-style-type:circle}._ul ._ul ._ul{list-style-type:square}._abbr,._b,._code,._del,._em,._i,._ins,._label,._q,._span,._strong,._sub,._sup{display:inline}._blockquote,._div,._p{display:block}
|
||||
1
components/mp-html/parser.js
Normal file
@@ -7,6 +7,7 @@ Component({
|
||||
properties: {
|
||||
title: String,
|
||||
canBack: Boolean,
|
||||
beforeBack: Function,
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -34,8 +35,11 @@ Component({
|
||||
* 组件的方法列表
|
||||
*/
|
||||
methods: {
|
||||
back() {
|
||||
// this.triggerEvent("back")
|
||||
async back() {
|
||||
const { beforeBack } = this;
|
||||
if (beforeBack) {
|
||||
await beforeBack();
|
||||
}
|
||||
wx.navigateBack();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,10 +5,26 @@ Component({
|
||||
properties: {
|
||||
currentIndex: { //当前页码
|
||||
type: Number,
|
||||
value: 1
|
||||
value: 1,
|
||||
observer(newVal,oldVal) {// 数据监听
|
||||
const that = this;
|
||||
this.setData({
|
||||
index: newVal
|
||||
}, () => {
|
||||
that.updateBtnDis();
|
||||
})
|
||||
},
|
||||
},
|
||||
totalPage: {
|
||||
type: Number
|
||||
type: Number,
|
||||
observer(newVal,oldVal) {// 数据监听
|
||||
const that = this;
|
||||
this.setData({
|
||||
total: newVal
|
||||
}, () => {
|
||||
that.updateBtnDis();
|
||||
})
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
@@ -74,7 +90,6 @@ Component({
|
||||
},
|
||||
//更改页码点击事件
|
||||
onChangePage: function (e) {
|
||||
//console.log("更改页码事件:",e);
|
||||
this.setData({
|
||||
pageMask: false,
|
||||
index: e.currentTarget.dataset.index //点击的页数
|
||||
@@ -124,17 +139,17 @@ Component({
|
||||
})
|
||||
}else if (index == total) { // 最后一页
|
||||
this.setData({
|
||||
nextBtnDis: true
|
||||
nextBtnDis: true,
|
||||
prevBtnDis: false,
|
||||
})
|
||||
} else if (index == 1){ // 第一页
|
||||
this.setData({
|
||||
prevBtnDis: true
|
||||
prevBtnDis: true,
|
||||
nextBtnDis: false,
|
||||
})
|
||||
}else{
|
||||
this.setData({
|
||||
prevBtnDis: false
|
||||
})
|
||||
this.setData({
|
||||
prevBtnDis: false,
|
||||
nextBtnDis: false
|
||||
})
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -15,13 +15,6 @@ Component({
|
||||
title: String,
|
||||
},
|
||||
|
||||
/**
|
||||
* 组件的初始数据
|
||||
*/
|
||||
data: {
|
||||
// columns:['杭州', '宁波', '温州', '嘉兴', '湖州']
|
||||
},
|
||||
|
||||
/**
|
||||
* 组件的方法列表
|
||||
*/
|
||||
|
||||
165
components/searchSelect/index.js
Normal file
@@ -0,0 +1,165 @@
|
||||
import { getLoginParkList, getParkBuildingList } from "../../service/park"
|
||||
import { getParkSimpleMeterList } from "../../service/meter"
|
||||
import { alertInfo } from "../../utils/index";
|
||||
import request from "../../utils/request"
|
||||
import { payWays, feeType } from "../../utils/data";
|
||||
import { getTenementList, getWxTenementList } from "../../service/tenement";
|
||||
const { OK } = request;
|
||||
|
||||
// components/searchSelect/index.js
|
||||
Component({
|
||||
|
||||
/**
|
||||
* 组件的属性列表
|
||||
*/
|
||||
properties: {
|
||||
title: String,
|
||||
type: String,
|
||||
show: Boolean,
|
||||
park: String,
|
||||
isBack: Boolean,
|
||||
},
|
||||
observers: {
|
||||
"show,type": function(newShow, newType) {
|
||||
if (newShow && newType) {
|
||||
this.onSearch()
|
||||
}
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 组件的初始数据
|
||||
*/
|
||||
data: {
|
||||
columns: [],
|
||||
searchText: "",
|
||||
payWays,
|
||||
feeType,
|
||||
},
|
||||
lifetimes: {
|
||||
attached() {
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 组件的方法列表
|
||||
*/
|
||||
methods: {
|
||||
onChangeSearch(e) {
|
||||
this.setData({
|
||||
searchText: e.detail,
|
||||
})
|
||||
},
|
||||
onCancel() {
|
||||
this.setData({
|
||||
columns: [],
|
||||
list: [],
|
||||
searchText: ""
|
||||
})
|
||||
this.triggerEvent("cancel")
|
||||
},
|
||||
onConfirm(event) {
|
||||
const { index } = event.detail;
|
||||
const { list = [], type } = this.data;
|
||||
const item = list[index];
|
||||
if (!item) {
|
||||
alertInfo("请选择一项")
|
||||
return
|
||||
}
|
||||
this.setData({
|
||||
columns: [],
|
||||
list: [],
|
||||
searchText: ""
|
||||
})
|
||||
this.triggerEvent("confirm", { data: item, type } );
|
||||
},
|
||||
onPayConfirm(event) {
|
||||
const { index } = event.detail;
|
||||
const { payWays = [], type } = this.data;
|
||||
const item = payWays[index];
|
||||
this.setData({
|
||||
columns: [],
|
||||
list: [],
|
||||
searchText: ""
|
||||
})
|
||||
this.triggerEvent("confirm", { data: item, way: index, type } );
|
||||
},
|
||||
onFeeTypeConfirm(event) {
|
||||
const { index } = event.detail;
|
||||
const { feeType = [], type } = this.data;
|
||||
const item = feeType[index];
|
||||
this.setData({
|
||||
columns: [],
|
||||
list: [],
|
||||
searchText: ""
|
||||
})
|
||||
this.triggerEvent("confirm", { data: item, way: index, type } );
|
||||
},
|
||||
onSearch() {
|
||||
const { type } = this.data;
|
||||
switch(type) {
|
||||
case "park":
|
||||
this.onSearchPark();
|
||||
return;
|
||||
case "meter":
|
||||
this.onSearchMeter();
|
||||
return
|
||||
case "tenement":
|
||||
this.onSearchTenement();
|
||||
return;
|
||||
case "building":
|
||||
this.onSearchBuilding();
|
||||
return;
|
||||
}
|
||||
},
|
||||
async onSearchPark() {
|
||||
const { searchText = "" } = this.data;
|
||||
const { code, message, data: parks = [] } = await getLoginParkList({keyword: searchText});
|
||||
if (code !== OK) {
|
||||
alertInfo(message)
|
||||
return
|
||||
}
|
||||
this.setData({
|
||||
columns: parks?.map(item => item?.name),
|
||||
list: parks,
|
||||
})
|
||||
},
|
||||
async onSearchMeter() {
|
||||
const { searchText = "", park } = this.data;
|
||||
const { code, message, data: parks = [] } = await getParkSimpleMeterList({keyword: searchText, park});
|
||||
if (code !== OK) {
|
||||
alertInfo(message)
|
||||
return
|
||||
}
|
||||
this.setData({
|
||||
columns: parks?.map(item => `${item.meterNo}-${item.address}${item.shortName ? '-' + item.shortName : ''}`) || [],
|
||||
list: parks || [],
|
||||
})
|
||||
},
|
||||
async onSearchTenement() {
|
||||
const { searchText = "", park, isBack } = this.data;
|
||||
const { code, message, data = [] } = isBack ? await getWxTenementList({keyword: searchText, park}) : await getTenementList({keyword: searchText, park});
|
||||
if (code !== OK) {
|
||||
alertInfo(message)
|
||||
return
|
||||
}
|
||||
this.setData({
|
||||
columns: data?.length ? data?.map(item => item?.name) : [],
|
||||
list: data,
|
||||
})
|
||||
},
|
||||
async onSearchBuilding() {
|
||||
const { park } = this.data;
|
||||
const { code, message, buildings: data = [] } = await getParkBuildingList(park);
|
||||
if (code !== OK) {
|
||||
alertInfo(message)
|
||||
return
|
||||
}
|
||||
this.setData({
|
||||
columns: data?.length ? data?.map(item => item?.name) : [],
|
||||
list: data,
|
||||
})
|
||||
},
|
||||
}
|
||||
})
|
||||
|
||||
8
components/searchSelect/index.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"van-popup": "@vant/weapp/popup/index",
|
||||
"van-picker": "@vant/weapp/picker/index",
|
||||
"van-search": "@vant/weapp/search/index"
|
||||
}
|
||||
}
|
||||
62
components/searchSelect/index.wxml
Normal file
@@ -0,0 +1,62 @@
|
||||
<!--components/searchSelect/index.wxml-->
|
||||
<van-popup
|
||||
show="{{ show }}"
|
||||
bind:click="onClickHide"
|
||||
position="bottom"
|
||||
z-index="100000"
|
||||
wx:if="{{show}}"
|
||||
>
|
||||
<view wx:if="{{type === 'pay'}}">
|
||||
<van-picker
|
||||
custom-style="width: 100%;"
|
||||
columns="{{ payWays }}"
|
||||
title="{{title}}"
|
||||
show-toolbar="{{true}}"
|
||||
bind:cancel="onCancel"
|
||||
bind:confirm="onPayConfirm"
|
||||
/>
|
||||
</view>
|
||||
<view wx:elif="{{type === 'feeType'}}">
|
||||
<van-picker
|
||||
custom-style="width: 100%;"
|
||||
columns="{{ feeType }}"
|
||||
title="{{title}}"
|
||||
show-toolbar="{{true}}"
|
||||
bind:cancel="onCancel"
|
||||
bind:confirm="onFeeTypeConfirm"
|
||||
/>
|
||||
</view>
|
||||
<view wx:elif="{{type !== 'pay'}}">
|
||||
<van-search
|
||||
value="{{ value }}"
|
||||
placeholder="{{type === 'tenement' ? '请输入关键词搜索后选择' : '请输入搜索关键词'}}"
|
||||
use-action-slot
|
||||
bind:change="onChangeSearch"
|
||||
>
|
||||
<view
|
||||
style="margin-left: 20rpx; margin-right: 20rpx"
|
||||
slot="action"
|
||||
bind:tap="onSearch"
|
||||
>搜索</view>
|
||||
</van-search>
|
||||
<van-picker
|
||||
custom-style="width: 100%;"
|
||||
columns="{{ columns }}"
|
||||
title="{{title}}"
|
||||
show-toolbar="{{true}}"
|
||||
bind:cancel="onCancel"
|
||||
bind:confirm="onConfirm"
|
||||
/>
|
||||
</view>
|
||||
|
||||
<view wx:else>
|
||||
<van-picker
|
||||
custom-style="width: 100%;"
|
||||
columns="{{ columns }}"
|
||||
title="{{title}}"
|
||||
show-toolbar="{{true}}"
|
||||
bind:cancel="onCancel"
|
||||
bind:confirm="onConfirm"
|
||||
/>
|
||||
</view>
|
||||
</van-popup>
|
||||
1
components/searchSelect/index.wxss
Normal file
@@ -0,0 +1 @@
|
||||
/* components/searchSelect/index.wxss */
|
||||
48
components/searchSelectWrapper/index.js
Normal file
@@ -0,0 +1,48 @@
|
||||
// components/searchSelectWrapper/index.js
|
||||
Component({
|
||||
|
||||
/**
|
||||
* 组件的属性列表
|
||||
*/
|
||||
properties: {
|
||||
label: String,
|
||||
placeholder: String,
|
||||
text: String,
|
||||
fieldType: {
|
||||
type: String,
|
||||
value: "text"
|
||||
},
|
||||
type: {
|
||||
type: String,
|
||||
value: "select"
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 组件的初始数据
|
||||
*/
|
||||
data: {
|
||||
keyword: "",
|
||||
text: "",
|
||||
},
|
||||
|
||||
/**
|
||||
* 组件的方法列表
|
||||
*/
|
||||
methods: {
|
||||
onSearch() {
|
||||
this.triggerEvent("search")
|
||||
},
|
||||
onChangeKeyword(e) {
|
||||
this.setData({ keyword: e.detail });
|
||||
},
|
||||
onChangeText(e) {
|
||||
this.setData({ text: e.detail });
|
||||
this.triggerEvent("changeText", e.detail)
|
||||
},
|
||||
onSearchKeyword() {
|
||||
this.triggerEvent("searchKeyword", this.data.keyword)
|
||||
this.setData({ keyword: "" })
|
||||
}
|
||||
}
|
||||
})
|
||||
8
components/searchSelectWrapper/index.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"van-icon": "@vant/weapp/icon/index",
|
||||
"van-button": "@vant/weapp/button/index",
|
||||
"van-field": "@vant/weapp/field/index"
|
||||
}
|
||||
}
|
||||
35
components/searchSelectWrapper/index.wxml
Normal file
@@ -0,0 +1,35 @@
|
||||
<!--components/searchSelectWrapper/index.wxml-->
|
||||
<view class="wrapper" wx:if="{{type === 'select'}}">
|
||||
<view class="label"> {{ label }} </view>
|
||||
<view class="content" bind:tap="clickTime" bind:tap="onSearch">
|
||||
<view class="text" wx:if="{{!text}}" style="color: #ccc;"> {{placeholder}} </view>
|
||||
<view class="text" wx:else> {{text}} </view>
|
||||
<van-icon name="arrow-down" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="wrapper" wx:if="{{type === 'inputSearch'}}">
|
||||
<view class="label"> {{ label }} </view>
|
||||
<view class="inputContent" bind:tap="clickTime">
|
||||
<van-field
|
||||
value="{{ value }}"
|
||||
placeholder="{{placeholder}}"
|
||||
border="{{ false }}"
|
||||
bind:change="onChangeKeyword"
|
||||
custom-style="padding: 0;font-size: 30rpx;line-height: 32rpx;"
|
||||
/>
|
||||
</view>
|
||||
<van-button type="info" size="small" bind:click="onSearchKeyword"> 搜索 </van-button>
|
||||
</view>
|
||||
<view class="wrapper" wx:if="{{type === 'input'}}">
|
||||
<view class="label"> {{ label }} </view>
|
||||
<view class="inputContent" bind:tap="clickTime">
|
||||
<van-field
|
||||
value="{{ value }}"
|
||||
placeholder="{{placeholder}}"
|
||||
border="{{ false }}"
|
||||
type="fieldType"
|
||||
bind:change="onChangeText"
|
||||
custom-style="padding: 0;font-size: 30rpx;line-height: 32rpx;"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
37
components/searchSelectWrapper/index.wxss
Normal file
@@ -0,0 +1,37 @@
|
||||
/* components/searchSelectWrapper/index.wxss */
|
||||
.wrapper {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-size: 30rpx;
|
||||
padding: 20rpx;
|
||||
}
|
||||
|
||||
.content {
|
||||
flex: 1;
|
||||
margin-left: 30rpx;
|
||||
margin-right: 30rpx;
|
||||
display: flex;
|
||||
padding: 10rpx 20rpx;
|
||||
border-radius: 12rpx;
|
||||
border: 1rpx solid #ccc;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.inputContent {
|
||||
flex: 1;
|
||||
margin-left: 30rpx;
|
||||
margin-right: 30rpx;
|
||||
display: flex;
|
||||
padding: 0 20rpx;
|
||||
border-radius: 12rpx;
|
||||
border: 1rpx solid #ccc;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.text {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.label {
|
||||
width: 120rpx;
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
import { getParkList } from "../../service/park";
|
||||
import { getLoginParkList } from "../../service/park";
|
||||
import { getTenementList } from "../../service/tenement";
|
||||
import request from '../../utils/request'
|
||||
|
||||
const { OK } = request
|
||||
// components/select/index.js
|
||||
|
||||
Component({
|
||||
|
||||
/**
|
||||
@@ -30,13 +30,9 @@ Component({
|
||||
*/
|
||||
methods: {
|
||||
async onInput(e) {
|
||||
// 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 });
|
||||
const { data = [], code, message } = await getLoginParkList({ keyword: e.detail });
|
||||
this.setData({
|
||||
list: data,
|
||||
visible: true,
|
||||
|
||||
@@ -27,6 +27,9 @@ Component({
|
||||
type: String,
|
||||
value: '#d6e8ff'
|
||||
},
|
||||
topColor: String,
|
||||
topStyle: String,
|
||||
bodyStyle: String,
|
||||
maxLine: {
|
||||
type: Number,
|
||||
value: 2
|
||||
|
||||
@@ -8,12 +8,19 @@
|
||||
</wxs>
|
||||
<scroll-view hidden="{{!showList.length||!showHeader.length}}" scroll-x class="table1-view" style="--max_line:{{maxLine}};--width:{{getTableWidth(tableWidth)}}">
|
||||
<view class="table1 d-table table-class">
|
||||
<view class="d-table-row tr-class">
|
||||
<view class="d-table-cell th-class" wx:for="{{showHeader}}" wx:key="index">{{item.title}}</view>
|
||||
<view class="d-table-row tr-class" style="{{topColor ? 'background-color: rgb(242,248,246)' : ''}}">
|
||||
<view class="d-table-cell th-class" style="{{topStyle}}" wx:for="{{showHeader}}" wx:key="index">{{item.title}}</view>
|
||||
</view>
|
||||
<view bindtap="onTap" data-index="{{index}}" bindlongpress="onLongPress" class="tr-class d-table-row {{currentIndex===index?'active':''}} {{index%2===0?'tr-class_even':'tr-class_odd'}}" wx:for="{{showList}}" wx:key="index">
|
||||
<view class="d-table-cell td-class " wx:for="{{showHeader}}" wx:for-item="head" wx:for-index="hindex" wx:key="hindex" style="background-color: {{item[head.key].bg}};color:{{item[head.key].color}}">
|
||||
<view class="text">
|
||||
<view
|
||||
class="d-table-cell td-class"
|
||||
wx:for="{{showHeader}}"
|
||||
wx:for-item="head"
|
||||
wx:for-index="hindex"
|
||||
wx:key="hindex"
|
||||
style="background-color: {{item[head.key].bg}};color:{{item[head.key].color}}"
|
||||
>
|
||||
<view class="text" style="{{bodyStyle}}">
|
||||
{{item[head.key].text}}
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -23,6 +23,7 @@ Component({
|
||||
year: String,
|
||||
month: Number,
|
||||
day: Number,
|
||||
currentDate: Number,
|
||||
},
|
||||
/**
|
||||
* 组件的初始数据
|
||||
|
||||
12
node_modules/.package-lock.json
generated
vendored
@@ -1,12 +0,0 @@
|
||||
{
|
||||
"name": "electricity_bill_calc_wx",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"node_modules/@vant/weapp": {
|
||||
"version": "1.11.4",
|
||||
"resolved": "https://registry.npmmirror.com/@vant/weapp/-/weapp-1.11.4.tgz",
|
||||
"integrity": "sha512-egOsWO4hVMP1SQSqQ46jy8UD3WysvlnUecRzPM21Y3ovkOFZ6wlaO7oHQmTXRpwr+V41Qri1qEbtNjhVxFqdyw=="
|
||||
}
|
||||
}
|
||||
}
|
||||
7
node_modules/@vant/weapp/LICENSE
generated
vendored
@@ -1,7 +0,0 @@
|
||||
Copyright 2016-present Youzan
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
129
node_modules/@vant/weapp/README.md
generated
vendored
@@ -1,129 +0,0 @@
|
||||
<p align="center">
|
||||
<img alt="logo" src="https://img.yzcdn.cn/vant/logo.png" width="120" style="margin-bottom: 10px;">
|
||||
</p>
|
||||
<h3 align="center">轻量、可靠的小程序 UI 组件库</h3>
|
||||
|
||||
<p align="center">
|
||||
<img src="https://img.shields.io/npm/v/@vant/weapp.svg?style=for-the-badge" alt="npm version" />
|
||||
<img src="https://img.shields.io/badge/License-MIT-blue.svg?style=for-the-badge&color=#4fc08d" />
|
||||
<img src="https://img.shields.io/npm/dt/@vant/weapp.svg?style=for-the-badge&color=#4fc08d" alt="downloads" />
|
||||
<img src="https://img.shields.io/npm/dm/@vant/weapp.svg?style=for-the-badge&color=#4fc08d" alt="downloads" />
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
🔥 <a href="https://vant-contrib.gitee.io/vant-weapp">文档网站(国内)</a>
|
||||
|
||||
🌈 <a href="https://youzan.github.io/vant-weapp">文档网站(GitHub)</a>
|
||||
|
||||
🚀 <a href="https://github.com/vant-ui/vant" target="_blank">Vue 版</a>
|
||||
</p>
|
||||
|
||||
---
|
||||
|
||||
### 介绍
|
||||
|
||||
Vant 是一个**轻量、可靠的移动端组件库**,于 2017 年开源。
|
||||
|
||||
目前 Vant 官方提供了 [Vue 2 版本](https://vant-contrib.gitee.io/vant/v2)、[Vue 3 版本](https://vant-contrib.gitee.io/vant)和[微信小程序版本](http://vant-contrib.gitee.io/vant-weapp),并由社区团队维护 [React 版本](https://github.com/3lang3/react-vant)和[支付宝小程序版本](https://github.com/ant-move/Vant-Aliapp)。
|
||||
|
||||
## 预览
|
||||
|
||||
扫描下方小程序二维码,体验组件库示例。注意:因微信审核机制限制,目前示例小程序不是最新版本,可以 clone 代码到本地开发工具预览
|
||||
|
||||
<img src="https://img.yzcdn.cn/vant-weapp/qrcode-201808101114.jpg" width="200" height="200" style="margin-top: 10px;" >
|
||||
|
||||
## 使用之前
|
||||
|
||||
使用 Vant Weapp 前,请确保你已经学习过微信官方的 [小程序简易教程](https://developers.weixin.qq.com/miniprogram/dev/framework/) 和 [自定义组件介绍](https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/)。
|
||||
|
||||
## 安装
|
||||
|
||||
### 方式一. 通过 npm 安装 (推荐)
|
||||
|
||||
小程序已经支持使用 npm 安装第三方包,详见 [npm 支持](https://developers.weixin.qq.com/miniprogram/dev/devtools/npm.html?search-key=npm)
|
||||
|
||||
```bash
|
||||
# 通过 npm 安装
|
||||
npm i @vant/weapp -S --production
|
||||
|
||||
# 通过 yarn 安装
|
||||
yarn add @vant/weapp --production
|
||||
|
||||
# 安装 0.x 版本
|
||||
npm i vant-weapp -S --production
|
||||
```
|
||||
|
||||
### 方式二. 下载代码
|
||||
|
||||
直接通过 git 下载 Vant Weapp 源代码,并将 `dist` 目录拷贝到自己的项目中。
|
||||
|
||||
```bash
|
||||
git clone https://github.com/youzan/vant-weapp.git
|
||||
```
|
||||
|
||||
## 使用组件
|
||||
|
||||
以按钮组件为例,只需要在 json 文件中引入按钮对应的自定义组件即可
|
||||
|
||||
```json
|
||||
{
|
||||
"usingComponents": {
|
||||
"van-button": "/path/to/vant-weapp/dist/button/index"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
接着就可以在 wxml 中直接使用组件
|
||||
|
||||
```html
|
||||
<van-button type="primary">按钮</van-button>
|
||||
```
|
||||
|
||||
## 在开发者工具中预览
|
||||
|
||||
```bash
|
||||
# 安装项目依赖
|
||||
npm install
|
||||
|
||||
# 执行组件编译
|
||||
npm run dev
|
||||
```
|
||||
|
||||
打开[微信开发者工具](https://developers.weixin.qq.com/miniprogram/dev/devtools/download.html),把`vant-weapp/example`目录添加进去就可以预览示例了。
|
||||
|
||||
PS:关于 `van-area` Area 省市区选择组件,地区数据初始化可以直接在云开发环境中导入`vant-weapp/example/database_area.JSON` 文件使用。
|
||||
|
||||
## 基础库版本
|
||||
|
||||
Vant Weapp 最低支持到小程序基础库 2.6.5 版本。
|
||||
|
||||
## 链接
|
||||
|
||||
- [意见反馈](https://github.com/youzan/vant-weapp/issues)
|
||||
- [设计资源](https://vant-contrib.gitee.io/vant/#/zh-CN/design)
|
||||
- [更新日志](https://vant-contrib.gitee.io/vant-weapp/#/changelog)
|
||||
- [官方示例](https://github.com/vant-ui/vant-demo)
|
||||
|
||||
## 核心团队
|
||||
|
||||
以下是 Vant 和 Vant Weapp 的核心贡献者们:
|
||||
|
||||
| [](https://github.com/chenjiahan/) | [](https://github.com/cookfront/) | [](https://github.com/w91/) | [](https://github.com/pangxie1991/) | [](https://github.com/rex-zsd/) | [](https://github.com/nemo-shen/) |
|
||||
| :-: | :-: | :-: | :-: | :-: | :-: |
|
||||
| [chenjiahan](https://github.com/chenjiahan/) | [cookfront](https://github.com/cookfront/) | [wangnaiyi](https://github.com/w91/) | [pangxie](https://github.com/pangxie1991/) | [rex-zsd](https://github.com/rex-zsd/) | [nemo-shen](https://github.com/nemo-shen/) |
|
||||
|
||||
| [](https://github.com/Lindysen/) | [](https://github.com/JakeLaoyu/) | [](https://github.com/landluck/) | [](https://github.com/wjw-gavin/) | [](https://github.com/inottn/) | [](https://github.com/zhousg/) |
|
||||
| :-: | :-: | :-: | :-: | :-: | :-: |
|
||||
| [Lindysen](https://github.com/Lindysen/) | [JakeLaoyu](https://github.com/JakeLaoyu/) | [landluck](https://github.com/landluck/) | [wjw-gavin](https://github.com/wjw-gavin/) | [inottn](https://github.com/inottn/) | [zhousg](https://github.com/zhousg/) |
|
||||
|
||||
## 贡献者们
|
||||
|
||||
感谢以下小伙伴们为 Vant Weapp 发展做出的贡献:
|
||||
|
||||
<a href="https://github.com/youzan/vant-weapp/graphs/contributors">
|
||||
<img src="https://opencollective.com/vant-weapp/contributors.svg?width=890&button=false" alt="contributors">
|
||||
</a>
|
||||
|
||||
## 开源协议
|
||||
|
||||
本项目基于 [MIT](https://zh.wikipedia.org/wiki/MIT%E8%A8%B1%E5%8F%AF%E8%AD%89)协议,请自由地享受和参与开源。
|
||||
1
node_modules/@vant/weapp/dist/action-sheet/index.d.ts
generated
vendored
@@ -1 +0,0 @@
|
||||
export {};
|
||||
75
node_modules/@vant/weapp/dist/action-sheet/index.js
generated
vendored
@@ -1,75 +0,0 @@
|
||||
import { VantComponent } from '../common/component';
|
||||
import { button } from '../mixins/button';
|
||||
VantComponent({
|
||||
classes: ['list-class'],
|
||||
mixins: [button],
|
||||
props: {
|
||||
show: Boolean,
|
||||
title: String,
|
||||
cancelText: String,
|
||||
description: String,
|
||||
round: {
|
||||
type: Boolean,
|
||||
value: true,
|
||||
},
|
||||
zIndex: {
|
||||
type: Number,
|
||||
value: 100,
|
||||
},
|
||||
actions: {
|
||||
type: Array,
|
||||
value: [],
|
||||
},
|
||||
overlay: {
|
||||
type: Boolean,
|
||||
value: true,
|
||||
},
|
||||
closeOnClickOverlay: {
|
||||
type: Boolean,
|
||||
value: true,
|
||||
},
|
||||
closeOnClickAction: {
|
||||
type: Boolean,
|
||||
value: true,
|
||||
},
|
||||
safeAreaInsetBottom: {
|
||||
type: Boolean,
|
||||
value: true,
|
||||
},
|
||||
rootPortal: {
|
||||
type: Boolean,
|
||||
value: false,
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
onSelect(event) {
|
||||
const { index } = event.currentTarget.dataset;
|
||||
const { actions, closeOnClickAction, canIUseGetUserProfile } = this.data;
|
||||
const item = actions[index];
|
||||
if (item) {
|
||||
this.$emit('select', item);
|
||||
if (closeOnClickAction) {
|
||||
this.onClose();
|
||||
}
|
||||
if (item.openType === 'getUserInfo' && canIUseGetUserProfile) {
|
||||
wx.getUserProfile({
|
||||
desc: item.getUserProfileDesc || ' ',
|
||||
complete: (userProfile) => {
|
||||
this.$emit('getuserinfo', userProfile);
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
onCancel() {
|
||||
this.$emit('cancel');
|
||||
},
|
||||
onClose() {
|
||||
this.$emit('close');
|
||||
},
|
||||
onClickOverlay() {
|
||||
this.$emit('click-overlay');
|
||||
this.onClose();
|
||||
},
|
||||
},
|
||||
});
|
||||
8
node_modules/@vant/weapp/dist/action-sheet/index.json
generated
vendored
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"van-icon": "../icon/index",
|
||||
"van-popup": "../popup/index",
|
||||
"van-loading": "../loading/index"
|
||||
}
|
||||
}
|
||||
70
node_modules/@vant/weapp/dist/action-sheet/index.wxml
generated
vendored
@@ -1,70 +0,0 @@
|
||||
<wxs src="../wxs/utils.wxs" module="utils" />
|
||||
|
||||
<van-popup
|
||||
show="{{ show }}"
|
||||
position="bottom"
|
||||
round="{{ round }}"
|
||||
z-index="{{ zIndex }}"
|
||||
overlay="{{ overlay }}"
|
||||
custom-class="van-action-sheet custom-class"
|
||||
safe-area-inset-bottom="{{ safeAreaInsetBottom }}"
|
||||
close-on-click-overlay="{{ closeOnClickOverlay }}"
|
||||
root-portal="{{ rootPortal }}"
|
||||
bind:close="onClickOverlay"
|
||||
>
|
||||
<view wx:if="{{ title }}" class="van-action-sheet__header">
|
||||
{{ title }}
|
||||
<van-icon
|
||||
name="cross"
|
||||
custom-class="van-action-sheet__close"
|
||||
bind:click="onClose"
|
||||
/>
|
||||
</view>
|
||||
<view wx:if="{{ description }}" class="van-action-sheet__description van-hairline--bottom">
|
||||
{{ description }}
|
||||
</view>
|
||||
<view wx:if="{{ actions && actions.length }}" class="list-class">
|
||||
<!-- button外包一层view,防止actions动态变化,导致渲染时button被打散 -->
|
||||
<button
|
||||
wx:for="{{ actions }}"
|
||||
wx:key="index"
|
||||
open-type="{{ item.disabled || item.loading || (canIUseGetUserProfile && item.openType === 'getUserInfo') ? '' : item.openType }}"
|
||||
style="{{ item.color ? 'color: ' + item.color : '' }}"
|
||||
class="{{ utils.bem('action-sheet__item', { disabled: item.disabled || item.loading }) }} {{ item.className || '' }}"
|
||||
hover-class="van-action-sheet__item--hover"
|
||||
data-index="{{ index }}"
|
||||
bindtap="{{ item.disabled || item.loading ? '' : 'onSelect' }}"
|
||||
bindgetuserinfo="onGetUserInfo"
|
||||
bindcontact="onContact"
|
||||
bindgetphonenumber="onGetPhoneNumber"
|
||||
binderror="onError"
|
||||
bindlaunchapp="onLaunchApp"
|
||||
bindopensetting="onOpenSetting"
|
||||
lang="{{ lang }}"
|
||||
session-from="{{ sessionFrom }}"
|
||||
send-message-title="{{ sendMessageTitle }}"
|
||||
send-message-path="{{ sendMessagePath }}"
|
||||
send-message-img="{{ sendMessageImg }}"
|
||||
show-message-card="{{ showMessageCard }}"
|
||||
app-parameter="{{ appParameter }}"
|
||||
>
|
||||
<block wx:if="{{ !item.loading }}">
|
||||
{{ item.name }}
|
||||
<view wx:if="{{ item.subname }}" class="van-action-sheet__subname" >{{ item.subname }}</view>
|
||||
</block>
|
||||
<van-loading wx:else custom-class="van-action-sheet__loading" size="22px" />
|
||||
</button>
|
||||
</view>
|
||||
<slot />
|
||||
<block wx:if="{{ cancelText }}">
|
||||
<view class="van-action-sheet__gap" />
|
||||
<view
|
||||
class="van-action-sheet__cancel"
|
||||
hover-class="van-action-sheet__cancel--hover"
|
||||
hover-stay-time="70"
|
||||
bind:tap="onCancel"
|
||||
>
|
||||
{{ cancelText }}
|
||||
</view>
|
||||
</block>
|
||||
</van-popup>
|
||||
1
node_modules/@vant/weapp/dist/action-sheet/index.wxss
generated
vendored
@@ -1 +0,0 @@
|
||||
@import '../common/index.wxss';.van-action-sheet{color:var(--action-sheet-item-text-color,#323233);max-height:var(--action-sheet-max-height,90%)!important}.van-action-sheet__cancel,.van-action-sheet__item{background-color:var(--action-sheet-item-background,#fff);font-size:var(--action-sheet-item-font-size,16px);line-height:var(--action-sheet-item-line-height,22px);padding:14px 16px;text-align:center}.van-action-sheet__cancel--hover,.van-action-sheet__item--hover{background-color:#f2f3f5}.van-action-sheet__cancel:after,.van-action-sheet__item:after{border-width:0}.van-action-sheet__cancel{color:var(--action-sheet-cancel-text-color,#646566)}.van-action-sheet__gap{background-color:var(--action-sheet-cancel-padding-color,#f7f8fa);display:block;height:var(--action-sheet-cancel-padding-top,8px)}.van-action-sheet__item--disabled{color:var(--action-sheet-item-disabled-text-color,#c8c9cc)}.van-action-sheet__item--disabled.van-action-sheet__item--hover{background-color:var(--action-sheet-item-background,#fff)}.van-action-sheet__subname{color:var(--action-sheet-subname-color,#969799);font-size:var(--action-sheet-subname-font-size,12px);line-height:var(--action-sheet-subname-line-height,20px);margin-top:var(--padding-xs,8px)}.van-action-sheet__header{font-size:var(--action-sheet-header-font-size,16px);font-weight:var(--font-weight-bold,500);line-height:var(--action-sheet-header-height,48px);text-align:center}.van-action-sheet__description{color:var(--action-sheet-description-color,#969799);font-size:var(--action-sheet-description-font-size,14px);line-height:var(--action-sheet-description-line-height,20px);padding:20px var(--padding-md,16px);text-align:center}.van-action-sheet__close{color:var(--action-sheet-close-icon-color,#c8c9cc);font-size:var(--action-sheet-close-icon-size,22px)!important;line-height:inherit!important;padding:var(--action-sheet-close-icon-padding,0 16px);position:absolute!important;right:0;top:0}.van-action-sheet__loading{display:flex!important}
|
||||
1
node_modules/@vant/weapp/dist/area/index.d.ts
generated
vendored
@@ -1 +0,0 @@
|
||||
export {};
|
||||
220
node_modules/@vant/weapp/dist/area/index.js
generated
vendored
@@ -1,220 +0,0 @@
|
||||
import { VantComponent } from '../common/component';
|
||||
import { pickerProps } from '../picker/shared';
|
||||
import { requestAnimationFrame } from '../common/utils';
|
||||
const EMPTY_CODE = '000000';
|
||||
VantComponent({
|
||||
classes: ['active-class', 'toolbar-class', 'column-class'],
|
||||
props: Object.assign(Object.assign({}, pickerProps), { showToolbar: {
|
||||
type: Boolean,
|
||||
value: true,
|
||||
}, value: {
|
||||
type: String,
|
||||
observer(value) {
|
||||
this.code = value;
|
||||
this.setValues();
|
||||
},
|
||||
}, areaList: {
|
||||
type: Object,
|
||||
value: {},
|
||||
observer: 'setValues',
|
||||
}, columnsNum: {
|
||||
type: null,
|
||||
value: 3,
|
||||
}, columnsPlaceholder: {
|
||||
type: Array,
|
||||
observer(val) {
|
||||
this.setData({
|
||||
typeToColumnsPlaceholder: {
|
||||
province: val[0] || '',
|
||||
city: val[1] || '',
|
||||
county: val[2] || '',
|
||||
},
|
||||
});
|
||||
},
|
||||
} }),
|
||||
data: {
|
||||
columns: [{ values: [] }, { values: [] }, { values: [] }],
|
||||
typeToColumnsPlaceholder: {},
|
||||
},
|
||||
mounted() {
|
||||
requestAnimationFrame(() => {
|
||||
this.setValues();
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
getPicker() {
|
||||
if (this.picker == null) {
|
||||
this.picker = this.selectComponent('.van-area__picker');
|
||||
}
|
||||
return this.picker;
|
||||
},
|
||||
onCancel(event) {
|
||||
this.emit('cancel', event.detail);
|
||||
},
|
||||
onConfirm(event) {
|
||||
const { index } = event.detail;
|
||||
let { value } = event.detail;
|
||||
value = this.parseValues(value);
|
||||
this.emit('confirm', { value, index });
|
||||
},
|
||||
emit(type, detail) {
|
||||
detail.values = detail.value;
|
||||
delete detail.value;
|
||||
this.$emit(type, detail);
|
||||
},
|
||||
parseValues(values) {
|
||||
const { columnsPlaceholder } = this.data;
|
||||
return values.map((value, index) => {
|
||||
if (value &&
|
||||
(!value.code || value.name === columnsPlaceholder[index])) {
|
||||
return Object.assign(Object.assign({}, value), { code: '', name: '' });
|
||||
}
|
||||
return value;
|
||||
});
|
||||
},
|
||||
onChange(event) {
|
||||
var _a;
|
||||
const { index, picker, value } = event.detail;
|
||||
this.code = value[index].code;
|
||||
(_a = this.setValues()) === null || _a === void 0 ? void 0 : _a.then(() => {
|
||||
this.$emit('change', {
|
||||
picker,
|
||||
values: this.parseValues(picker.getValues()),
|
||||
index,
|
||||
});
|
||||
});
|
||||
},
|
||||
getConfig(type) {
|
||||
const { areaList } = this.data;
|
||||
return (areaList && areaList[`${type}_list`]) || {};
|
||||
},
|
||||
getList(type, code) {
|
||||
if (type !== 'province' && !code) {
|
||||
return [];
|
||||
}
|
||||
const { typeToColumnsPlaceholder } = this.data;
|
||||
const list = this.getConfig(type);
|
||||
let result = Object.keys(list).map((code) => ({
|
||||
code,
|
||||
name: list[code],
|
||||
}));
|
||||
if (code != null) {
|
||||
// oversea code
|
||||
if (code[0] === '9' && type === 'city') {
|
||||
code = '9';
|
||||
}
|
||||
result = result.filter((item) => item.code.indexOf(code) === 0);
|
||||
}
|
||||
if (typeToColumnsPlaceholder[type] && result.length) {
|
||||
// set columns placeholder
|
||||
const codeFill = type === 'province'
|
||||
? ''
|
||||
: type === 'city'
|
||||
? EMPTY_CODE.slice(2, 4)
|
||||
: EMPTY_CODE.slice(4, 6);
|
||||
result.unshift({
|
||||
code: `${code}${codeFill}`,
|
||||
name: typeToColumnsPlaceholder[type],
|
||||
});
|
||||
}
|
||||
return result;
|
||||
},
|
||||
getIndex(type, code) {
|
||||
let compareNum = type === 'province' ? 2 : type === 'city' ? 4 : 6;
|
||||
const list = this.getList(type, code.slice(0, compareNum - 2));
|
||||
// oversea code
|
||||
if (code[0] === '9' && type === 'province') {
|
||||
compareNum = 1;
|
||||
}
|
||||
code = code.slice(0, compareNum);
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
if (list[i].code.slice(0, compareNum) === code) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
},
|
||||
setValues() {
|
||||
const picker = this.getPicker();
|
||||
if (!picker) {
|
||||
return;
|
||||
}
|
||||
let code = this.code || this.getDefaultCode();
|
||||
const provinceList = this.getList('province');
|
||||
const cityList = this.getList('city', code.slice(0, 2));
|
||||
const stack = [];
|
||||
const indexes = [];
|
||||
const { columnsNum } = this.data;
|
||||
if (columnsNum >= 1) {
|
||||
stack.push(picker.setColumnValues(0, provinceList, false));
|
||||
indexes.push(this.getIndex('province', code));
|
||||
}
|
||||
if (columnsNum >= 2) {
|
||||
stack.push(picker.setColumnValues(1, cityList, false));
|
||||
indexes.push(this.getIndex('city', code));
|
||||
if (cityList.length && code.slice(2, 4) === '00') {
|
||||
[{ code }] = cityList;
|
||||
}
|
||||
}
|
||||
if (columnsNum === 3) {
|
||||
stack.push(picker.setColumnValues(2, this.getList('county', code.slice(0, 4)), false));
|
||||
indexes.push(this.getIndex('county', code));
|
||||
}
|
||||
return Promise.all(stack)
|
||||
.catch(() => { })
|
||||
.then(() => picker.setIndexes(indexes))
|
||||
.catch(() => { });
|
||||
},
|
||||
getDefaultCode() {
|
||||
const { columnsPlaceholder } = this.data;
|
||||
if (columnsPlaceholder.length) {
|
||||
return EMPTY_CODE;
|
||||
}
|
||||
const countyCodes = Object.keys(this.getConfig('county'));
|
||||
if (countyCodes[0]) {
|
||||
return countyCodes[0];
|
||||
}
|
||||
const cityCodes = Object.keys(this.getConfig('city'));
|
||||
if (cityCodes[0]) {
|
||||
return cityCodes[0];
|
||||
}
|
||||
return '';
|
||||
},
|
||||
getValues() {
|
||||
const picker = this.getPicker();
|
||||
if (!picker) {
|
||||
return [];
|
||||
}
|
||||
return this.parseValues(picker.getValues().filter((value) => !!value));
|
||||
},
|
||||
getDetail() {
|
||||
const values = this.getValues();
|
||||
const area = {
|
||||
code: '',
|
||||
country: '',
|
||||
province: '',
|
||||
city: '',
|
||||
county: '',
|
||||
};
|
||||
if (!values.length) {
|
||||
return area;
|
||||
}
|
||||
const names = values.map((item) => item.name);
|
||||
area.code = values[values.length - 1].code;
|
||||
if (area.code[0] === '9') {
|
||||
area.country = names[1] || '';
|
||||
area.province = names[2] || '';
|
||||
}
|
||||
else {
|
||||
area.province = names[0] || '';
|
||||
area.city = names[1] || '';
|
||||
area.county = names[2] || '';
|
||||
}
|
||||
return area;
|
||||
},
|
||||
reset(code) {
|
||||
this.code = code || '';
|
||||
return this.setValues();
|
||||
},
|
||||
},
|
||||
});
|
||||
6
node_modules/@vant/weapp/dist/area/index.json
generated
vendored
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"van-picker": "../picker/index"
|
||||
}
|
||||
}
|
||||
20
node_modules/@vant/weapp/dist/area/index.wxml
generated
vendored
@@ -1,20 +0,0 @@
|
||||
<wxs src="./index.wxs" module="computed" />
|
||||
|
||||
<van-picker
|
||||
class="van-area__picker"
|
||||
active-class="active-class"
|
||||
toolbar-class="toolbar-class"
|
||||
column-class="column-class"
|
||||
show-toolbar="{{ showToolbar }}"
|
||||
value-key="name"
|
||||
title="{{ title }}"
|
||||
loading="{{ loading }}"
|
||||
columns="{{ computed.displayColumns(columns, columnsNum) }}"
|
||||
item-height="{{ itemHeight }}"
|
||||
visible-item-count="{{ visibleItemCount }}"
|
||||
cancel-button-text="{{ cancelButtonText }}"
|
||||
confirm-button-text="{{ confirmButtonText }}"
|
||||
bind:change="onChange"
|
||||
bind:confirm="onConfirm"
|
||||
bind:cancel="onCancel"
|
||||
/>
|
||||
8
node_modules/@vant/weapp/dist/area/index.wxs
generated
vendored
@@ -1,8 +0,0 @@
|
||||
/* eslint-disable */
|
||||
function displayColumns(columns, columnsNum) {
|
||||
return columns.slice(0, +columnsNum);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
displayColumns: displayColumns,
|
||||
};
|
||||
1
node_modules/@vant/weapp/dist/area/index.wxss
generated
vendored
@@ -1 +0,0 @@
|
||||
@import '../common/index.wxss';
|
||||
1
node_modules/@vant/weapp/dist/button/index.d.ts
generated
vendored
@@ -1 +0,0 @@
|
||||
export {};
|
||||
64
node_modules/@vant/weapp/dist/button/index.js
generated
vendored
@@ -1,64 +0,0 @@
|
||||
import { VantComponent } from '../common/component';
|
||||
import { button } from '../mixins/button';
|
||||
import { canIUseFormFieldButton } from '../common/version';
|
||||
const mixins = [button];
|
||||
if (canIUseFormFieldButton()) {
|
||||
mixins.push('wx://form-field-button');
|
||||
}
|
||||
VantComponent({
|
||||
mixins,
|
||||
classes: ['hover-class', 'loading-class'],
|
||||
data: {
|
||||
baseStyle: '',
|
||||
},
|
||||
props: {
|
||||
formType: String,
|
||||
icon: String,
|
||||
classPrefix: {
|
||||
type: String,
|
||||
value: 'van-icon',
|
||||
},
|
||||
plain: Boolean,
|
||||
block: Boolean,
|
||||
round: Boolean,
|
||||
square: Boolean,
|
||||
loading: Boolean,
|
||||
hairline: Boolean,
|
||||
disabled: Boolean,
|
||||
loadingText: String,
|
||||
customStyle: String,
|
||||
loadingType: {
|
||||
type: String,
|
||||
value: 'circular',
|
||||
},
|
||||
type: {
|
||||
type: String,
|
||||
value: 'default',
|
||||
},
|
||||
dataset: null,
|
||||
size: {
|
||||
type: String,
|
||||
value: 'normal',
|
||||
},
|
||||
loadingSize: {
|
||||
type: String,
|
||||
value: '20px',
|
||||
},
|
||||
color: String,
|
||||
},
|
||||
methods: {
|
||||
onClick(event) {
|
||||
this.$emit('click', event);
|
||||
const { canIUseGetUserProfile, openType, getUserProfileDesc, lang, } = this.data;
|
||||
if (openType === 'getUserInfo' && canIUseGetUserProfile) {
|
||||
wx.getUserProfile({
|
||||
desc: getUserProfileDesc || ' ',
|
||||
lang: lang || 'en',
|
||||
complete: (userProfile) => {
|
||||
this.$emit('getuserinfo', userProfile);
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
7
node_modules/@vant/weapp/dist/button/index.json
generated
vendored
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"van-icon": "../icon/index",
|
||||
"van-loading": "../loading/index"
|
||||
}
|
||||
}
|
||||
56
node_modules/@vant/weapp/dist/button/index.wxml
generated
vendored
@@ -1,56 +0,0 @@
|
||||
<wxs src="../wxs/utils.wxs" module="utils" />
|
||||
<wxs src="./index.wxs" module="computed" />
|
||||
|
||||
<button
|
||||
id="{{ id || buttonId }}"
|
||||
data-detail="{{ dataset }}"
|
||||
class="custom-class {{ utils.bem('button', [type, size, { block, round, plain, square, loading, disabled, hairline, unclickable: disabled || loading }]) }} {{ hairline ? 'van-hairline--surround' : '' }}"
|
||||
hover-class="{{ disabled || loading ? '' : 'van-button--active hover-class'}}"
|
||||
lang="{{ lang }}"
|
||||
form-type="{{ formType }}"
|
||||
style="{{ computed.rootStyle({ plain, color, customStyle }) }}"
|
||||
open-type="{{ disabled || loading || (canIUseGetUserProfile && openType === 'getUserInfo') ? '' : openType }}"
|
||||
business-id="{{ businessId }}"
|
||||
session-from="{{ sessionFrom }}"
|
||||
send-message-title="{{ sendMessageTitle }}"
|
||||
send-message-path="{{ sendMessagePath }}"
|
||||
send-message-img="{{ sendMessageImg }}"
|
||||
show-message-card="{{ showMessageCard }}"
|
||||
app-parameter="{{ appParameter }}"
|
||||
aria-label="{{ ariaLabel }}"
|
||||
bindtap="{{ disabled || loading ? '' : 'onClick' }}"
|
||||
bindgetuserinfo="onGetUserInfo"
|
||||
bindcontact="onContact"
|
||||
bindgetphonenumber="onGetPhoneNumber"
|
||||
bindgetrealtimephonenumber="onGetRealTimePhoneNumber"
|
||||
bindagreeprivacyauthorization="onAgreePrivacyAuthorization"
|
||||
binderror="onError"
|
||||
bindlaunchapp="onLaunchApp"
|
||||
bindopensetting="onOpenSetting"
|
||||
bindchooseavatar="onChooseAvatar"
|
||||
>
|
||||
<block wx:if="{{ loading }}">
|
||||
<van-loading
|
||||
custom-class="loading-class"
|
||||
size="{{ loadingSize }}"
|
||||
type="{{ loadingType }}"
|
||||
color="{{ computed.loadingColor({ type, color, plain }) }}"
|
||||
/>
|
||||
<view wx:if="{{ loadingText }}" class="van-button__loading-text">
|
||||
{{ loadingText }}
|
||||
</view>
|
||||
</block>
|
||||
<block wx:else>
|
||||
<van-icon
|
||||
wx:if="{{ icon }}"
|
||||
size="1.2em"
|
||||
name="{{ icon }}"
|
||||
class-prefix="{{ classPrefix }}"
|
||||
class="van-button__icon"
|
||||
custom-style="line-height: inherit;"
|
||||
/>
|
||||
<view class="van-button__text">
|
||||
<slot />
|
||||
</view>
|
||||
</block>
|
||||
</button>
|
||||
39
node_modules/@vant/weapp/dist/button/index.wxs
generated
vendored
@@ -1,39 +0,0 @@
|
||||
/* eslint-disable */
|
||||
var style = require('../wxs/style.wxs');
|
||||
|
||||
function rootStyle(data) {
|
||||
if (!data.color) {
|
||||
return data.customStyle;
|
||||
}
|
||||
|
||||
var properties = {
|
||||
color: data.plain ? data.color : '#fff',
|
||||
background: data.plain ? null : data.color,
|
||||
};
|
||||
|
||||
// hide border when color is linear-gradient
|
||||
if (data.color.indexOf('gradient') !== -1) {
|
||||
properties.border = 0;
|
||||
} else {
|
||||
properties['border-color'] = data.color;
|
||||
}
|
||||
|
||||
return style([properties, data.customStyle]);
|
||||
}
|
||||
|
||||
function loadingColor(data) {
|
||||
if (data.plain) {
|
||||
return data.color ? data.color : '#c9c9c9';
|
||||
}
|
||||
|
||||
if (data.type === 'default') {
|
||||
return '#c9c9c9';
|
||||
}
|
||||
|
||||
return '#fff';
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
rootStyle: rootStyle,
|
||||
loadingColor: loadingColor,
|
||||
};
|
||||
1
node_modules/@vant/weapp/dist/button/index.wxss
generated
vendored
@@ -1 +0,0 @@
|
||||
@import '../common/index.wxss';.van-button{-webkit-text-size-adjust:100%;align-items:center;-webkit-appearance:none;border-radius:var(--button-border-radius,2px);box-sizing:border-box;display:inline-flex;font-size:var(--button-default-font-size,16px);height:var(--button-default-height,44px);justify-content:center;line-height:var(--button-line-height,20px);padding:0;position:relative;text-align:center;transition:opacity .2s;vertical-align:middle}.van-button:before{background-color:#000;border:inherit;border-color:#000;border-radius:inherit;content:" ";height:100%;left:50%;opacity:0;position:absolute;top:50%;transform:translate(-50%,-50%);width:100%}.van-button:after{border-width:0}.van-button--active:before{opacity:.15}.van-button--unclickable:after{display:none}.van-button--default{background:var(--button-default-background-color,#fff);border:var(--button-border-width,1px) solid var(--button-default-border-color,#ebedf0);color:var(--button-default-color,#323233)}.van-button--primary{background:var(--button-primary-background-color,#07c160);border:var(--button-border-width,1px) solid var(--button-primary-border-color,#07c160);color:var(--button-primary-color,#fff)}.van-button--info{background:var(--button-info-background-color,#1989fa);border:var(--button-border-width,1px) solid var(--button-info-border-color,#1989fa);color:var(--button-info-color,#fff)}.van-button--danger{background:var(--button-danger-background-color,#ee0a24);border:var(--button-border-width,1px) solid var(--button-danger-border-color,#ee0a24);color:var(--button-danger-color,#fff)}.van-button--warning{background:var(--button-warning-background-color,#ff976a);border:var(--button-border-width,1px) solid var(--button-warning-border-color,#ff976a);color:var(--button-warning-color,#fff)}.van-button--plain{background:var(--button-plain-background-color,#fff)}.van-button--plain.van-button--primary{color:var(--button-primary-background-color,#07c160)}.van-button--plain.van-button--info{color:var(--button-info-background-color,#1989fa)}.van-button--plain.van-button--danger{color:var(--button-danger-background-color,#ee0a24)}.van-button--plain.van-button--warning{color:var(--button-warning-background-color,#ff976a)}.van-button--large{height:var(--button-large-height,50px);width:100%}.van-button--normal{font-size:var(--button-normal-font-size,14px);padding:0 15px}.van-button--small{font-size:var(--button-small-font-size,12px);height:var(--button-small-height,30px);min-width:var(--button-small-min-width,60px);padding:0 var(--padding-xs,8px)}.van-button--mini{display:inline-block;font-size:var(--button-mini-font-size,10px);height:var(--button-mini-height,22px);min-width:var(--button-mini-min-width,50px)}.van-button--mini+.van-button--mini{margin-left:5px}.van-button--block{display:flex;width:100%}.van-button--round{border-radius:var(--button-round-border-radius,999px)}.van-button--square{border-radius:0}.van-button--disabled{opacity:var(--button-disabled-opacity,.5)}.van-button__text{display:inline}.van-button__icon+.van-button__text:not(:empty),.van-button__loading-text{margin-left:4px}.van-button__icon{line-height:inherit!important;min-width:1em;vertical-align:top}.van-button--hairline{border-width:0;padding-top:1px}.van-button--hairline:after{border-color:inherit;border-radius:calc(var(--button-border-radius, 2px)*2);border-width:1px}.van-button--hairline.van-button--round:after{border-radius:var(--button-round-border-radius,999px)}.van-button--hairline.van-button--square:after{border-radius:0}
|
||||
70
node_modules/@vant/weapp/dist/calendar/calendar.wxml
generated
vendored
@@ -1,70 +0,0 @@
|
||||
<wxs src="./index.wxs" module="computed" />
|
||||
<wxs src="../wxs/utils.wxs" module="utils" />
|
||||
<view class="van-calendar">
|
||||
<header
|
||||
title="{{ title }}"
|
||||
showTitle="{{ showTitle }}"
|
||||
subtitle="{{ subtitle }}"
|
||||
showSubtitle="{{ showSubtitle }}"
|
||||
firstDayOfWeek="{{ firstDayOfWeek }}"
|
||||
bind:click-subtitle="onClickSubtitle"
|
||||
>
|
||||
<slot name="title" slot="title"></slot>
|
||||
</header>
|
||||
|
||||
<scroll-view
|
||||
class="van-calendar__body"
|
||||
scroll-y
|
||||
scroll-into-view="{{ scrollIntoView }}"
|
||||
>
|
||||
<month
|
||||
wx:for="{{ computed.getMonths(minDate, maxDate) }}"
|
||||
wx:key="index"
|
||||
id="month{{ index }}"
|
||||
class="month"
|
||||
data-date="{{ item }}"
|
||||
date="{{ item }}"
|
||||
type="{{ type }}"
|
||||
color="{{ color }}"
|
||||
minDate="{{ minDate }}"
|
||||
maxDate="{{ maxDate }}"
|
||||
showMark="{{ showMark }}"
|
||||
formatter="{{ formatter }}"
|
||||
rowHeight="{{ rowHeight }}"
|
||||
currentDate="{{ currentDate }}"
|
||||
showSubtitle="{{ showSubtitle }}"
|
||||
allowSameDay="{{ allowSameDay }}"
|
||||
showMonthTitle="{{ index !== 0 || !showSubtitle }}"
|
||||
firstDayOfWeek="{{ firstDayOfWeek }}"
|
||||
bind:click="onClickDay"
|
||||
/>
|
||||
</scroll-view>
|
||||
|
||||
<view
|
||||
class="{{ utils.bem('calendar__footer', { safeAreaInsetBottom }) }}"
|
||||
>
|
||||
<slot name="footer"></slot>
|
||||
</view>
|
||||
|
||||
<view
|
||||
class="{{ utils.bem('calendar__footer', { safeAreaInsetBottom }) }}"
|
||||
>
|
||||
<van-button
|
||||
wx:if="{{ showConfirm }}"
|
||||
round
|
||||
block
|
||||
type="danger"
|
||||
color="{{ color }}"
|
||||
custom-class="van-calendar__confirm"
|
||||
disabled="{{ computed.getButtonDisabled(type, currentDate, minRange) }}"
|
||||
nativeType="text"
|
||||
bind:click="onConfirm"
|
||||
>
|
||||
{{
|
||||
computed.getButtonDisabled(type, currentDate, minRange)
|
||||
? confirmDisabledText
|
||||
: confirmText
|
||||
}}
|
||||
</van-button>
|
||||
</view>
|
||||
</view>
|
||||
1
node_modules/@vant/weapp/dist/calendar/index.d.ts
generated
vendored
@@ -1 +0,0 @@
|
||||
export {};
|
||||
360
node_modules/@vant/weapp/dist/calendar/index.js
generated
vendored
@@ -1,360 +0,0 @@
|
||||
import { VantComponent } from '../common/component';
|
||||
import { ROW_HEIGHT, getPrevDay, getNextDay, getToday, compareDay, copyDates, calcDateNum, formatMonthTitle, compareMonth, getMonths, getDayByOffset, } from './utils';
|
||||
import Toast from '../toast/toast';
|
||||
import { requestAnimationFrame } from '../common/utils';
|
||||
const initialMinDate = getToday().getTime();
|
||||
const initialMaxDate = (() => {
|
||||
const now = getToday();
|
||||
return new Date(now.getFullYear(), now.getMonth() + 6, now.getDate()).getTime();
|
||||
})();
|
||||
const getTime = (date) => date instanceof Date ? date.getTime() : date;
|
||||
VantComponent({
|
||||
props: {
|
||||
title: {
|
||||
type: String,
|
||||
value: '日期选择',
|
||||
},
|
||||
color: String,
|
||||
show: {
|
||||
type: Boolean,
|
||||
observer(val) {
|
||||
if (val) {
|
||||
this.initRect();
|
||||
this.scrollIntoView();
|
||||
}
|
||||
},
|
||||
},
|
||||
formatter: null,
|
||||
confirmText: {
|
||||
type: String,
|
||||
value: '确定',
|
||||
},
|
||||
confirmDisabledText: {
|
||||
type: String,
|
||||
value: '确定',
|
||||
},
|
||||
rangePrompt: String,
|
||||
showRangePrompt: {
|
||||
type: Boolean,
|
||||
value: true,
|
||||
},
|
||||
defaultDate: {
|
||||
type: null,
|
||||
value: getToday().getTime(),
|
||||
observer(val) {
|
||||
this.setData({ currentDate: val });
|
||||
this.scrollIntoView();
|
||||
},
|
||||
},
|
||||
allowSameDay: Boolean,
|
||||
type: {
|
||||
type: String,
|
||||
value: 'single',
|
||||
observer: 'reset',
|
||||
},
|
||||
minDate: {
|
||||
type: Number,
|
||||
value: initialMinDate,
|
||||
},
|
||||
maxDate: {
|
||||
type: Number,
|
||||
value: initialMaxDate,
|
||||
},
|
||||
position: {
|
||||
type: String,
|
||||
value: 'bottom',
|
||||
},
|
||||
rowHeight: {
|
||||
type: null,
|
||||
value: ROW_HEIGHT,
|
||||
},
|
||||
round: {
|
||||
type: Boolean,
|
||||
value: true,
|
||||
},
|
||||
poppable: {
|
||||
type: Boolean,
|
||||
value: true,
|
||||
},
|
||||
showMark: {
|
||||
type: Boolean,
|
||||
value: true,
|
||||
},
|
||||
showTitle: {
|
||||
type: Boolean,
|
||||
value: true,
|
||||
},
|
||||
showConfirm: {
|
||||
type: Boolean,
|
||||
value: true,
|
||||
},
|
||||
showSubtitle: {
|
||||
type: Boolean,
|
||||
value: true,
|
||||
},
|
||||
safeAreaInsetBottom: {
|
||||
type: Boolean,
|
||||
value: true,
|
||||
},
|
||||
closeOnClickOverlay: {
|
||||
type: Boolean,
|
||||
value: true,
|
||||
},
|
||||
maxRange: {
|
||||
type: null,
|
||||
value: null,
|
||||
},
|
||||
minRange: {
|
||||
type: Number,
|
||||
value: 1,
|
||||
},
|
||||
firstDayOfWeek: {
|
||||
type: Number,
|
||||
value: 0,
|
||||
},
|
||||
readonly: Boolean,
|
||||
rootPortal: {
|
||||
type: Boolean,
|
||||
value: false,
|
||||
},
|
||||
},
|
||||
data: {
|
||||
subtitle: '',
|
||||
currentDate: null,
|
||||
scrollIntoView: '',
|
||||
},
|
||||
watch: {
|
||||
minDate() {
|
||||
this.initRect();
|
||||
},
|
||||
maxDate() {
|
||||
this.initRect();
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.setData({
|
||||
currentDate: this.getInitialDate(this.data.defaultDate),
|
||||
});
|
||||
},
|
||||
mounted() {
|
||||
if (this.data.show || !this.data.poppable) {
|
||||
this.initRect();
|
||||
this.scrollIntoView();
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
reset() {
|
||||
this.setData({ currentDate: this.getInitialDate(this.data.defaultDate) });
|
||||
this.scrollIntoView();
|
||||
},
|
||||
initRect() {
|
||||
if (this.contentObserver != null) {
|
||||
this.contentObserver.disconnect();
|
||||
}
|
||||
const contentObserver = this.createIntersectionObserver({
|
||||
thresholds: [0, 0.1, 0.9, 1],
|
||||
observeAll: true,
|
||||
});
|
||||
this.contentObserver = contentObserver;
|
||||
contentObserver.relativeTo('.van-calendar__body');
|
||||
contentObserver.observe('.month', (res) => {
|
||||
if (res.boundingClientRect.top <= res.relativeRect.top) {
|
||||
// @ts-ignore
|
||||
this.setData({ subtitle: formatMonthTitle(res.dataset.date) });
|
||||
}
|
||||
});
|
||||
},
|
||||
limitDateRange(date, minDate = null, maxDate = null) {
|
||||
minDate = minDate || this.data.minDate;
|
||||
maxDate = maxDate || this.data.maxDate;
|
||||
if (compareDay(date, minDate) === -1) {
|
||||
return minDate;
|
||||
}
|
||||
if (compareDay(date, maxDate) === 1) {
|
||||
return maxDate;
|
||||
}
|
||||
return date;
|
||||
},
|
||||
getInitialDate(defaultDate = null) {
|
||||
const { type, minDate, maxDate, allowSameDay } = this.data;
|
||||
if (!defaultDate)
|
||||
return [];
|
||||
const now = getToday().getTime();
|
||||
if (type === 'range') {
|
||||
if (!Array.isArray(defaultDate)) {
|
||||
defaultDate = [];
|
||||
}
|
||||
const [startDay, endDay] = defaultDate || [];
|
||||
const startDate = getTime(startDay || now);
|
||||
const start = this.limitDateRange(startDate, minDate, allowSameDay ? startDate : getPrevDay(new Date(maxDate)).getTime());
|
||||
const date = getTime(endDay || now);
|
||||
const end = this.limitDateRange(date, allowSameDay ? date : getNextDay(new Date(minDate)).getTime());
|
||||
return [start, end];
|
||||
}
|
||||
if (type === 'multiple') {
|
||||
if (Array.isArray(defaultDate)) {
|
||||
return defaultDate.map((date) => this.limitDateRange(date));
|
||||
}
|
||||
return [this.limitDateRange(now)];
|
||||
}
|
||||
if (!defaultDate || Array.isArray(defaultDate)) {
|
||||
defaultDate = now;
|
||||
}
|
||||
return this.limitDateRange(defaultDate);
|
||||
},
|
||||
scrollIntoView() {
|
||||
requestAnimationFrame(() => {
|
||||
const { currentDate, type, show, poppable, minDate, maxDate } = this.data;
|
||||
if (!currentDate)
|
||||
return;
|
||||
// @ts-ignore
|
||||
const targetDate = type === 'single' ? currentDate : currentDate[0];
|
||||
const displayed = show || !poppable;
|
||||
if (!targetDate || !displayed) {
|
||||
return;
|
||||
}
|
||||
const months = getMonths(minDate, maxDate);
|
||||
months.some((month, index) => {
|
||||
if (compareMonth(month, targetDate) === 0) {
|
||||
this.setData({ scrollIntoView: `month${index}` });
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
});
|
||||
},
|
||||
onOpen() {
|
||||
this.$emit('open');
|
||||
},
|
||||
onOpened() {
|
||||
this.$emit('opened');
|
||||
},
|
||||
onClose() {
|
||||
this.$emit('close');
|
||||
},
|
||||
onClosed() {
|
||||
this.$emit('closed');
|
||||
},
|
||||
onClickDay(event) {
|
||||
if (this.data.readonly) {
|
||||
return;
|
||||
}
|
||||
let { date } = event.detail;
|
||||
const { type, currentDate, allowSameDay } = this.data;
|
||||
if (type === 'range') {
|
||||
// @ts-ignore
|
||||
const [startDay, endDay] = currentDate;
|
||||
if (startDay && !endDay) {
|
||||
const compareToStart = compareDay(date, startDay);
|
||||
if (compareToStart === 1) {
|
||||
const { days } = this.selectComponent('.month').data;
|
||||
days.some((day, index) => {
|
||||
const isDisabled = day.type === 'disabled' &&
|
||||
getTime(startDay) < getTime(day.date) &&
|
||||
getTime(day.date) < getTime(date);
|
||||
if (isDisabled) {
|
||||
({ date } = days[index - 1]);
|
||||
}
|
||||
return isDisabled;
|
||||
});
|
||||
this.select([startDay, date], true);
|
||||
}
|
||||
else if (compareToStart === -1) {
|
||||
this.select([date, null]);
|
||||
}
|
||||
else if (allowSameDay) {
|
||||
this.select([date, date], true);
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.select([date, null]);
|
||||
}
|
||||
}
|
||||
else if (type === 'multiple') {
|
||||
let selectedIndex;
|
||||
// @ts-ignore
|
||||
const selected = currentDate.some((dateItem, index) => {
|
||||
const equal = compareDay(dateItem, date) === 0;
|
||||
if (equal) {
|
||||
selectedIndex = index;
|
||||
}
|
||||
return equal;
|
||||
});
|
||||
if (selected) {
|
||||
// @ts-ignore
|
||||
const cancelDate = currentDate.splice(selectedIndex, 1);
|
||||
this.setData({ currentDate });
|
||||
this.unselect(cancelDate);
|
||||
}
|
||||
else {
|
||||
// @ts-ignore
|
||||
this.select([...currentDate, date]);
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.select(date, true);
|
||||
}
|
||||
},
|
||||
unselect(dateArray) {
|
||||
const date = dateArray[0];
|
||||
if (date) {
|
||||
this.$emit('unselect', copyDates(date));
|
||||
}
|
||||
},
|
||||
select(date, complete) {
|
||||
if (complete && this.data.type === 'range') {
|
||||
const valid = this.checkRange(date);
|
||||
if (!valid) {
|
||||
// auto selected to max range if showConfirm
|
||||
if (this.data.showConfirm) {
|
||||
this.emit([
|
||||
date[0],
|
||||
getDayByOffset(date[0], this.data.maxRange - 1),
|
||||
]);
|
||||
}
|
||||
else {
|
||||
this.emit(date);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
this.emit(date);
|
||||
if (complete && !this.data.showConfirm) {
|
||||
this.onConfirm();
|
||||
}
|
||||
},
|
||||
emit(date) {
|
||||
this.setData({
|
||||
currentDate: Array.isArray(date) ? date.map(getTime) : getTime(date),
|
||||
});
|
||||
this.$emit('select', copyDates(date));
|
||||
},
|
||||
checkRange(date) {
|
||||
const { maxRange, rangePrompt, showRangePrompt } = this.data;
|
||||
if (maxRange && calcDateNum(date) > maxRange) {
|
||||
if (showRangePrompt) {
|
||||
Toast({
|
||||
context: this,
|
||||
message: rangePrompt || `选择天数不能超过 ${maxRange} 天`,
|
||||
});
|
||||
}
|
||||
this.$emit('over-range');
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
},
|
||||
onConfirm() {
|
||||
if (this.data.type === 'range' &&
|
||||
!this.checkRange(this.data.currentDate)) {
|
||||
return;
|
||||
}
|
||||
wx.nextTick(() => {
|
||||
// @ts-ignore
|
||||
this.$emit('confirm', copyDates(this.data.currentDate));
|
||||
});
|
||||
},
|
||||
onClickSubtitle(event) {
|
||||
this.$emit('click-subtitle', event);
|
||||
},
|
||||
},
|
||||
});
|
||||
10
node_modules/@vant/weapp/dist/calendar/index.json
generated
vendored
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"header": "./components/header/index",
|
||||
"month": "./components/month/index",
|
||||
"van-button": "../button/index",
|
||||
"van-popup": "../popup/index",
|
||||
"van-toast": "../toast/index"
|
||||
}
|
||||
}
|
||||
27
node_modules/@vant/weapp/dist/calendar/index.wxml
generated
vendored
@@ -1,27 +0,0 @@
|
||||
<wxs src="./index.wxs" module="computed" />
|
||||
<wxs src="../wxs/utils.wxs" module="utils" />
|
||||
|
||||
<import src="./calendar.wxml" />
|
||||
|
||||
<van-popup
|
||||
wx:if="{{ poppable }}"
|
||||
custom-class="van-calendar__popup--{{ position }}"
|
||||
close-icon-class="van-calendar__close-icon"
|
||||
show="{{ show }}"
|
||||
round="{{ round }}"
|
||||
position="{{ position }}"
|
||||
closeable="{{ showTitle || showSubtitle }}"
|
||||
close-on-click-overlay="{{ closeOnClickOverlay }}"
|
||||
safe-area-inset-bottom="{{ safeAreaInsetBottom }}"
|
||||
root-portal="{{ rootPortal }}"
|
||||
bind:enter="onOpen"
|
||||
bind:close="onClose"
|
||||
bind:after-enter="onOpened"
|
||||
bind:after-leave="onClosed"
|
||||
>
|
||||
<include src="./calendar.wxml" />
|
||||
</van-popup>
|
||||
|
||||
<include wx:else src="./calendar.wxml" />
|
||||
|
||||
<van-toast id="van-toast" />
|
||||
37
node_modules/@vant/weapp/dist/calendar/index.wxs
generated
vendored
@@ -1,37 +0,0 @@
|
||||
/* eslint-disable */
|
||||
var utils = require('./utils.wxs');
|
||||
|
||||
function getMonths(minDate, maxDate) {
|
||||
var months = [];
|
||||
var cursor = getDate(minDate);
|
||||
|
||||
cursor.setDate(1);
|
||||
|
||||
do {
|
||||
months.push(cursor.getTime());
|
||||
cursor.setMonth(cursor.getMonth() + 1);
|
||||
} while (utils.compareMonth(cursor, getDate(maxDate)) !== 1);
|
||||
|
||||
return months;
|
||||
}
|
||||
|
||||
function getButtonDisabled(type, currentDate, minRange) {
|
||||
if (currentDate == null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (type === 'range') {
|
||||
return !currentDate[0] || !currentDate[1];
|
||||
}
|
||||
|
||||
if (type === 'multiple') {
|
||||
return currentDate.length < minRange;
|
||||
}
|
||||
|
||||
return !currentDate;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
getMonths: getMonths,
|
||||
getButtonDisabled: getButtonDisabled
|
||||
};
|
||||
1
node_modules/@vant/weapp/dist/calendar/index.wxss
generated
vendored
@@ -1 +0,0 @@
|
||||
@import '../common/index.wxss';.van-calendar{background-color:var(--calendar-background-color,#fff);display:flex;flex-direction:column;height:var(--calendar-height,100%)}.van-calendar__close-icon{top:11px}.van-calendar__popup--bottom,.van-calendar__popup--top{height:var(--calendar-popup-height,90%)}.van-calendar__popup--left,.van-calendar__popup--right{height:100%}.van-calendar__body{-webkit-overflow-scrolling:touch;flex:1;overflow:auto}.van-calendar__footer{flex-shrink:0;padding:0 var(--padding-md,16px)}.van-calendar__footer--safe-area-inset-bottom{padding-bottom:env(safe-area-inset-bottom)}.van-calendar__footer+.van-calendar__footer,.van-calendar__footer:empty{display:none}.van-calendar__footer:empty+.van-calendar__footer{display:block!important}.van-calendar__confirm{height:var(--calendar-confirm-button-height,36px)!important;line-height:var(--calendar-confirm-button-line-height,34px)!important;margin:var(--calendar-confirm-button-margin,7px 0)!important}
|
||||