修改本地连接

This commit is contained in:
qiaomu 2024-04-10 15:36:38 +08:00
parent 7249c430b8
commit cae7b2767f
15 changed files with 283 additions and 19 deletions

View File

@ -1,8 +1,9 @@
{
"pages": [
"pages/home/index",
"pages/rechargeRecord/index",
"pages/invoicing/index",
"pages/invoiceList/index",
"pages/rechargeRecord/index",
"pages/member/index",
"pages/login/index",
"pages/handleLogin/index",

View File

@ -20,6 +20,8 @@ page {
--deep-green: #15755e;
--middle-green: rgb(75, 151, 131);
--light-green: rgb(174,218,203);
--transparent-green: rgb(208, 230, 222);
--money-color: #ee0a24;
/* background-color: #f0f0f0; */
}

View File

@ -17,7 +17,7 @@
<view class="chooseParkWrapper">
</view>
<view class="login" wx:if="{{!user || !user.id}}" class="notLoginWrapper">
<view class="login" wx:if="{{!user && !user.id}}" class="notLoginWrapper">
<van-image width="100rpx" height="100rpx" src="/assets/images/defaultAvatar.png" class="defaultAvatar"/>
<van-button type="primary" size="small" plain="{{true}}" class="loginBtn" bind:tap="jumpToLogin">请登录</van-button>
</view>

View File

@ -1,4 +1,9 @@
// pages/invoiceList/components/notyet/index.js
import { getInvoiceList } from '../../../../service/invoice';
import { alertInfo } from '../../../../utils/index';
import request from '../../../../utils/request';
const { OK } = request;
Component({
/**
@ -7,28 +12,80 @@ Component({
properties: {
},
lifetimes: {
attached() {
this.init();
}
},
/**
* 组件的初始数据
*/
data: {
chooseList: []
chooseList: [],
selectList: [],
list: [],
selectCount: 0,
selectMoney: 0,
},
/**
* 组件的方法列表
*/
methods: {
async init() {
const { code, message, data } = await getInvoiceList();
// if (code !== OK) {
// alertInfo(message)
// return;
// }
this.setData({ list: data, selectList: new Array(data?.length).map(() => false) })
},
onChange(e) {
const { id } = e.currentTarget.dataset;
let newList = this.data.chooseList;
const { id, index } = e.currentTarget.dataset;
// let newList = this.data.chooseList;
const { list } = this.data;
const newSelectList = this.data.selectList;
if (e.detail) {
newList = [...new Set([...newList, id])]
newSelectList[index] = true;
// newList = [...new Set([...newList, id])]
} else {
newList = newList.filter(item => item !== id);
newSelectList[index] = false;
// newList = newList.filter(item => item !== id);
}
let selectCount = 0;
let selectMoney = 0;
for(let i = 0; i < newSelectList.length; i ++) {
const item = newSelectList[i];
if (item) {
selectCount++;
selectMoney += list[i]?.money;
}
}
this.setData({
chooseList: newList,
// chooseList: newList,
selectList: newSelectList,
selectCount,
selectMoney
})
},
next() {
const { selectList, list, selectMoney, selectCount } = this.data;
let tenementID = "";
let ids = [];
for(let i = 0; i < selectList.length; i ++) {
if (selectList[i]) {
const currentTenementID = list[i]?.tenement?.id;
ids.push(list[i]?.id);
if (!tenementID) {
tenementID = currentTenementID;
} else if(tenementID !== currentTenementID) {
alertInfo("只能对一个公司开票")
return;
}
}
}
wx.navigateTo({
url: `/pages/invoicing/index?money=${selectMoney}&count=${selectCount}&tenement=${tenementID}&ids=${ids}`,
})
}
}

View File

@ -1,6 +1,7 @@
{
"component": true,
"usingComponents": {
"van-checkbox": "@vant/weapp/checkbox/index"
"van-checkbox": "@vant/weapp/checkbox/index",
"van-button": "@vant/weapp/button/index"
}
}

View File

@ -1,20 +1,21 @@
<van-checkbox-group value="{{ chooseList }}" bind:change="onChange" max="{{ 2 }}">
<view class="cardWrapper">
<view class="cardWrapper" wx:for="{{list}}" wx:key="index">
<view class="content">
<view class="left">
<view class="top">
<van-checkbox name="{{12}}" shape="square" bind:change="onChange" data-id="12" />
<view class="month">1月份</view>
<view class="address"> 软C306 </view>
<van-checkbox value="{{selectList[index]}}" shape="square" bind:change="onChange" data-index="{{index}}" data-id="{{item.id}}" />
<view class="month">{{item.time}}</view>
<view class="address"> {{ item.meter.address }} </view>
</view>
<view class="middle">
河北创新风华科技有限公司
{{ item.tenement.name }}
</view>
<view class="bottom">
2024年1月1日-2024年1月31日
{{ item.range[0] }} - {{ item.range[1] }}
</view>
</view>
<view class="rightMoney"> ¥ {{ item.money }} </view>
<view class="right">
待开票
</view>
@ -22,4 +23,11 @@
</view>
</van-checkbox-group>
<view class="allSelect">
<view class="allNumber"> {{ selectCount }} </view>
笔订单,共
<view class="allMoney"> ¥ {{selectMoney}} </view>
<van-button size="small" type="info" bind:click="next" disabled="{{!selectCount}}"> 下一步 </van-button>
</view>

View File

@ -35,3 +35,48 @@
border-radius: 18rpx;
color: rgb(224, 106, 106)
}
.allSelect {
position: fixed;
left: 0;
bottom: 0;
width: 100vw;
height: 100rpx;
background-color: #fff;
padding: 20rpx;
box-sizing: border-box;
display: flex;
align-items: center;
}
.allNumber {
margin-left: 20rpx;
margin-right: 20rpx;
color: #ee0a24;
}
.allMoney {
flex: 1;
margin-left: 20rpx;
color: var(--money-color);
}
.content {
display: flex;
align-items: center;
}
.rightMoney {
position: absolute;
right: 20rpx;
top: calc(50% - 20rpx);
font-size: 40rpx;
font-weight: 600;
}
.month {
width: 138rpx;
white-space: nowrap;
overflow: hidden;
}

71
pages/invoicing/index.js Normal file
View File

@ -0,0 +1,71 @@
// pages/invoicing/index.js
Page({
/**
* 页面的初始数据
*/
data: {
money: 0,
tenement: "",
ids: [],
count: 0,
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
const { money = 10, tenement, ids = 'q', count = 10 } = options;
console.log('option', options)
this.setData({ money, tenement, ids: ids.split(","), count })
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

View File

@ -0,0 +1,7 @@
{
"usingComponents": {
"navigator": "/components/navigator/index",
"van-button": "@vant/weapp/button/index"
},
"navigationStyle": "custom"
}

View File

@ -0,0 +1,14 @@
<!--pages/invoicing/index.wxml-->
<navigator title="1111" canBack="{{true}}" />
<view class="info">
<view class="money"> 发票金额:<text class="moneyNumber"> {{money}} </text> </view>
<view class="content">发票内容:<text class="contentText">电费</text> </view>
</view>
<view class="type"></view>
<view class="content">
</view>
<view class="submit">
<van-button type="info" block> 提交 </van-button>
</view>

View File

@ -0,0 +1,31 @@
/* pages/invoicing/index.wxss */
.submit {
margin-top: 40rpx;
margin-left: 32rpx;
margin-right: 32rpx;
margin-bottom: 40rpx;
}
.info {
margin: 30rpx;
border-radius: 20rpx;
padding: 26rpx;
background-color: #fff;
}
.info .moneyNumber {
color: var(--money-color)
}
.info .content {
margin-top: 20rpx;
}
.info .content .contentText {
margin-left: 10rpx;
font-weight: 600;
}
page {
background-color: var(--transparent-green);
}

View File

@ -1,4 +1,5 @@
import { getRechargeDetail } from "../../service/recharge";
import { getRechargeOperateType, getRechargeOperateWay } from "../../utils/data";
import request from "../../utils/request"
const { OK } = request
// pages/rechargeDetail/index.js
@ -21,7 +22,7 @@ Page({
async init(id) {
const { code, message, data } = await getRechargeDetail(id)
this.setData({
detail: data
detail: { ...data, way: getRechargeOperateWay(data.way), type: getRechargeOperateType(data.type) }
})
},
back() {

View File

@ -6,59 +6,79 @@
value="{{detail.tenement.name}}"
label="商户名称"
readonly
autosize="{{true}}"
type="textarea"
border="{{ false }}"
/>
<van-field
value="{{detail.meter.code}}"
label="电表编号"
readonly
autosize="{{true}}"
type="textarea"
border="{{ false }}"
/>
<van-field
value="{{detail.meter.address}}"
label="电表地址"
readonly
autosize="{{true}}"
type="textarea"
border="{{ false }}"
/>
<van-field
value="{{detail.time}}"
label="操作时间"
readonly
type="textarea"
autosize="{{true}}"
border="{{ false }}"
/>
<van-field
value="{{detail.account}}"
label="充值账号"
readonly
type="textarea"
autosize="{{true}}"
border="{{ false }}"
/>
<van-field
value="{{detail.money}}"
label="充值金额"
readonly
autosize="{{true}}"
type="textarea"
border="{{ false }}"
/>
<van-field
value="{{detail.tenement.name}}"
value="{{detail.type}}"
label="操作类型"
readonly
autosize="{{true}}"
type="textarea"
border="{{ false }}"
/>
<van-field
value="{{detail.tenement.name}}"
value="{{detail.way}}"
label="付款方式"
readonly
autosize="{{true}}"
type="textarea"
border="{{ false }}"
/>
<van-field
value="{{detail.voucherNo}}"
label="订单号"
type="textarea"
autosize="{{true}}"
readonly
border="{{ false }}"
/>
<van-field
value="{{detail.serialNumber}}"
label="流水号"
type="textarea"
autosize="{{true}}"
readonly
border="{{ false }}"
/>

View File

@ -87,3 +87,7 @@
white-space: nowrap;
text-overflow: ellipsis;
}
page {
/* background-color: var(--light-green); */
}

View File

@ -1,9 +1,11 @@
export const getRechargeOperateType = (num) => {
console.log('typenum', num)
const types = ["充值", "冲正", "退费"]
return types[num];
}
export const getRechargeOperateWay = (num) => {
console.log('num', num)
const types = ["现金", "银行卡", "支付宝", "微信", "云闪付"]
return types[num];
}