Commit ffbd4520 authored by 刘文虎's avatar 刘文虎

收支设置

parent cda4a970
Pipeline #3310 canceled with stages
...@@ -96,7 +96,12 @@ ...@@ -96,7 +96,12 @@
"UniversalLinks" : "" "UniversalLinks" : ""
} }
}, },
"maps" : {}, "maps" : {
"baidu" : {
"appkey_ios" : "dFMUnxGBq8mB8CSotGMELp4EGUq9qlwo",
"appkey_android" : "32HwrFwjGUFno8GddnqSZtP72sDFucG1"
}
},
"geolocation" : { "geolocation" : {
"baidu" : { "baidu" : {
"__platform__" : [ "android" ], "__platform__" : [ "android" ],
......
<template> <template>
<view class="input-view"> <view class="input-view">
<NavbarNormal :title="info.title" background="transparent" titleColor="#191C27" :border-bottom="false" title-bold></NavbarNormal> <NavbarNormal :title="info.title" titleColor="#191C27" :border-bottom="false" title-bold></NavbarNormal>
<view class="content-view"> <view class="content-view">
<u-input <u-input
v-model="value" v-model="value"
...@@ -49,11 +49,7 @@ export default { ...@@ -49,11 +49,7 @@ export default {
}; };
}, },
placeholderStyle() { placeholderStyle() {
return { return 'color: #cccccc;font-size: 28rpx;font-weight: bold;'
color: '#cccccc',
'font-size': '28rpx',
'font-weight': 'bold'
};
}, },
inputStyle() { inputStyle() {
return { return {
...@@ -163,7 +159,6 @@ export default { ...@@ -163,7 +159,6 @@ export default {
if (options && options.disabled) { if (options && options.disabled) {
this.disabled = options.disabled; this.disabled = options.disabled;
} }
uni.hideShareMenu();
}, },
onUnload() { onUnload() {
let notification = `input-sure-${this.type}`; let notification = `input-sure-${this.type}`;
......
<template>
<!-- 拖动 -->
<view class="edit-box" :style="{ top: 0 }">
<view class="zhuti">
<scroll-view :scroll-y="pageInfo.scrollY" class="product-section">
<view class="list" @click="closeAll">
<view class="swipe-action-outside" v-for="(item, index) in optionLists" :key="item.guid">
<u-swipe-action :show="item.show" bg-color="#f6f7fa" :index="item.guid" @click="handleClick" @open="open" :options="options">
<view
class="row list-row"
:data-index="index"
@longpress="longpress($event, item, index)"
@touchmove="dragMove"
@touchend="dragEnd($enent, item)"
:class="{ 'ready-place': pageInfo.readyPlaceIndex === index }"
:id="`item-view-${item.guid}`"
:style="'height: ' + pageInfo.rowHeight + 'px;'"
@click.stop="closeAll"
>
<view class="item-view">
<view class="left-view">
<view class="image-view"><image :src="billStaticBaseUrl + item.icon" v-if="item.icon"></image></view>
<view class="name-view">{{ item.label }}</view>
</view>
</view>
</view>
</u-swipe-action>
</view>
</view>
</scroll-view>
<movable-area class="movable-area" :style="'display:' + movableViewInfo.showClass + '; height:' + pageInfo.scrollHeight + '%'">
<movable-view
class="row list-row movable-row"
:out-of-bounds="true"
damping="999"
:style="'height:' + pageInfo.rowHeight + 'px;'"
direction="vertical"
:y="movableViewInfo.y"
>
<view class="item-view">
<view class="left-view">
<view class="image-view"><image :src="billStaticBaseUrl + movableViewInfo.data.icon" class="image-view" v-if="movableViewInfo.data.icon"></image></view>
<view class="name-view">{{ movableViewInfo.data && movableViewInfo.data.label }}</view>
</view>
</view>
</movable-view>
</movable-area>
</view>
<PopInput title="删除提醒" type="text" sureText="确定" content="确认删除该类别?" :visible.sync="showConfirm" @click="handleConfirm" @cancel="handleCancel" />
</view>
</template>
<script>
import PopInput from '@/components/pop-input-view';
import { billStaticBaseUrl } from '@/utils/config.js';
export default {
name: 'dragEdit',
props: ['list'],
components: {
PopInput
},
data() {
return {
billStaticBaseUrl,
showConfirm: false,
readyDeleteIndex: null,
options: [
{
text: '删除',
style: {
backgroundColor: '#FC524D'
}
},
{
text: '编辑',
style: {
backgroundColor: '#02A074'
}
}
],
// 拖动框内数据,配置
movableViewInfo: {
y: 0,
showClass: 'none',
data: {}
},
optionLists: [],
pageInfo: {
scrollY: true, // 当为true时拖动单条,整个大盒子不会滚动
rowHeight: 66, // 单条行高
scrollHeight: 100, // 拖动时行高,百分比
startIndex: null, // 当前拖动第几条
startY: 0, // 定位拖动时的位置,需要减去上方空白部分
readyPlaceIndex: null, // 拖动预放置位置,拖动时有阴影的部分
selectedIndex: null, // 放置的位置
beginMove: false
},
top: 0,
systemInfo: {}
};
},
watch: {
list: {
handler(val) {
this.optionLists = [...val];
},
immediate: true,
deep: true
}
},
computed: {},
mounted() {
this.systemInfo = uni.getSystemInfoSync();
this.optionLists = [...this.list];
},
methods: {
contentClick(e) {
console.log('contentClick', e);
setTimeout(() => {
this.closeAll();
}, 300);
},
handleClick(index, index1) {
let current = this.optionLists.findIndex(item => item.guid === index);
if (index1 == 1) {
this.toEdit(current);
setTimeout(() => {
this.closeAll();
}, 500);
} else {
this.beforeDelete(current);
}
},
// 如果打开一个的时候,不需要关闭其他,则无需实现本方法
open(index) {
// 先将正在被操作的swipeAction标记为打开状态,否则由于props的特性限制,
// 原本为'false',再次设置为'false'会无效
if (index === null) {
this.optionLists.map((val, idx) => {
this.optionLists[idx].show = false;
});
} else {
let current = this.optionLists.findIndex(item => item.guid === index);
this.optionLists[current].show = true;
this.optionLists.map((val, idx) => {
if (current !== idx) {
this.optionLists[idx].show = false;
}
});
}
console.log('open', this.optionLists);
},
toEdit(index) {
let value = this.optionLists[index].label;
this.$u.route({
url: '/pages/mine/input/input',
params: {
type: 'payments-setting',
value: encodeURIComponent(value)
}
});
uni.$once(`input-sure-payments-setting`, res => {
this.optionLists[index].label = res.content;
this.$emit('onEdit', this.optionLists[index]);
});
},
handleConfirm() {
let row = this.optionLists[this.readyDeleteIndex];
// this.optionLists.splice(this.readyDeleteIndex, 1);
this.optionLists[this.readyDeleteIndex].show = false;
this.$emit('onDelete', row);
},
handleCancel() {
this.optionLists[this.readyDeleteIndex].show = false;
},
beforeDelete(index) {
this.readyDeleteIndex = index;
this.showConfirm = true;
},
// 通知父组件修改排序
onChange() {
this.$emit('onChange', this.optionLists);
},
handleClickMember(row) {
this.$emit('handleClickMember', row);
},
closeAll() {
if (this.optionLists.length) {
this.open(null);
}
},
async longpress(event, item) {
console.log('longpress:', event, item);
this.closeAll();
await this.getTop(event, item);
},
getTop(event, item) {
let className = '.edit-box';
let info = uni
.createSelectorQuery()
.in(this)
.select(className);
info.boundingClientRect(data => {
//data - 各种参数
this.top = data.top;
this.dragStart(event, item);
}).exec();
},
// 拖拽开始(按下)
dragStart(event, item) {
console.log('dragStart');
// 开始本次拖拽
this.pageInfo.beginMove = true;
// 本次移动的view真实下标
var currentMoveIndex = (this.optionLists || []).findIndex(x => x.guid === item.guid);
console.log('currentMoveIndex', currentMoveIndex);
// var startIndex = event.currentTarget.dataset.index;
var startIndex = currentMoveIndex;
// 初始化页面数据
var pageInfo = this.pageInfo;
// 减去距离页面顶部的距离
// event.touches[0].clientY -
pageInfo.startY = event.touches[0].clientY - this.top;
pageInfo.readyPlaceIndex = startIndex;
pageInfo.selectedIndex = startIndex;
pageInfo.scrollY = false;
pageInfo.startIndex = startIndex;
// console.log('startIndex', pageInfo.readyPlaceIndex)
this.movableViewInfo.y = pageInfo.startY - pageInfo.rowHeight / 2;
// 初始化拖动控件数据
var movableViewInfo = this.movableViewInfo;
movableViewInfo.data = this.optionLists[startIndex];
movableViewInfo.showClass = 'inline';
(this.movableViewInfo = movableViewInfo), (this.pageInfo = pageInfo);
},
// 拖拽移动(按住不松)
dragMove(event) {
// 禁止无效的move
if (this.pageInfo.beginMove) {
var optionLists = JSON.parse(JSON.stringify(this.optionLists));
var pageInfo = this.pageInfo;
// 计算拖拽距离
var movableViewInfo = this.movableViewInfo;
//
var movedDistance = event.touches[0].clientY - this.top - pageInfo.startY;
movableViewInfo.y = pageInfo.startY - pageInfo.rowHeight / 2 + movedDistance;
// console.log('移动的距离为', movedDistance, movableViewInfo.y)
// 修改预计放置位置
var movedIndex = parseInt(movedDistance / pageInfo.rowHeight);
var readyPlaceIndex = pageInfo.startIndex + movedIndex;
if (readyPlaceIndex < 0) {
readyPlaceIndex = 0;
} else if (readyPlaceIndex >= optionLists.length) {
readyPlaceIndex = optionLists.length - 1;
}
if (readyPlaceIndex != pageInfo.selectedIndex) {
var selectedData = optionLists[pageInfo.selectedIndex];
optionLists.splice(pageInfo.selectedIndex, 1);
optionLists.splice(readyPlaceIndex, 0, selectedData);
// console.log('======optionLists', optionLists)
pageInfo.selectedIndex = readyPlaceIndex;
}
// 移动movableView
pageInfo.readyPlaceIndex = readyPlaceIndex;
// console.log('移动到了索引', readyPlaceIndex, '选项为', optionLists[readyPlaceIndex])
this.movableViewInfo = movableViewInfo;
this.optionLists = optionLists;
this.pageInfo = pageInfo;
}
},
// 拖拽结束(松手)
dragEnd(event,item) {
// 禁止无效的move
if (this.pageInfo.beginMove) {
console.log('dragEnd');
/**
* this.optionLists 在 dragMove 函数已经出现,
* 但是在 dragMove 函数会多次触发,
* 发送数据,及观察数据,在此处即可
*/
// 重置页面数据
var pageInfo = this.pageInfo;
let { startIndex, selectedIndex } = pageInfo;
// console.log('=====this.pageInfo before', this.pageInfo)
// console.log('event', event)
pageInfo.readyPlaceIndex = null;
pageInfo.startY = null;
pageInfo.selectedIndex = null;
pageInfo.startIndex = null;
pageInfo.scrollY = true;
// 隐藏movableView
var movableViewInfo = this.movableViewInfo;
movableViewInfo.showClass = 'none';
this.movableViewInfo = movableViewInfo;
this.pageInfo = pageInfo;
this.pageInfo.beginMove = false; //结束本次拖拽
// console.log('=====this.movableViewInfo', this.movableViewInfo)
// console.log('=====this.pageInfo', this.pageInfo)
// 通知父组件修改排序
this.onChange();
}
}
}
};
</script>
<style lang="scss" scoped>
/* 模块编辑 */
.edit-box {
width: 100%;
position: absolute;
bottom: 0;
left: 0;
overflow: hidden;
margin-bottom: 20rpx;
}
.marginL6 {
margin-left: 12rpx;
}
.product-section {
width: 100%;
height: 100%;
}
.list {
width: 100%;
.swipe-action-outside {
width: 100%;
background-color: #f6f7fa;
margin-bottom: 24upx;
}
.swipe-action-inner {
width: 100%;
// padding: 0 25upx;
}
}
.zhuti {
width: 100%;
position: absolute;
top: 0;
bottom: 0;
left: 0;
overflow: scroll;
}
.row {
height: 47px;
width: 100%;
display: flex;
justify-content: space-between;
align-items: center;
}
.title-row {
border-bottom: 1px solid #888888;
color: #888888;
}
.list-row {
// padding: 0 24rpx;
box-sizing: border-box;
// margin-bottom: 12px;
border-radius: 8rpx;
background-color: #fff;
width: 100%;
}
.movable-area {
position: absolute;
top: 0;
left: 0;
z-index: 10;
width: 100%;
// background-color: yellow;
}
.movable-row {
box-shadow: #d9d9d9 0 0 20px;
}
.col1 {
width: 90%;
}
.col3 {
width: 6%;
color: #3c63eb;
}
.ready-place {
background: rgba(238, 240, 254, 0.6);
}
.item-view {
width: 100%;
display: flex;
justify-content: space-between;
align-items: center;
height: 100%;
padding: 0 32rpx;
background-color: #fff;
border-radius: 16upx;
.left-view {
display: flex;
align-items: center;
width: 100%;
.image-view {
width: 72rpx;
height: 72rpx;
margin-right: 40rpx;
}
.name-view {
flex: 1;
font-size: 32rpx;
font-weight: bold;
}
}
.right-view {
height: 100%;
display: flex;
align-items: center;
}
}
</style>
...@@ -3,29 +3,31 @@ ...@@ -3,29 +3,31 @@
<view class="edit-box" :style="{ top: 0 }"> <view class="edit-box" :style="{ top: 0 }">
<view class="zhuti"> <view class="zhuti">
<scroll-view :scroll-y="pageInfo.scrollY" class="product-section"> <scroll-view :scroll-y="pageInfo.scrollY" class="product-section">
<view class="list" @click="closeAll"> <view class="list">
<uni-swipe-action>
<view class="swipe-action-outside" v-for="(item, index) in optionLists" :key="item.guid"> <view class="swipe-action-outside" v-for="(item, index) in optionLists" :key="item.guid">
<u-swipe-action :show="item.show" bg-color="#f6f7fa" :index="item.guid" @click="handleClick" @open="open" :options="options"> <uni-swipe-action-item :right-options="options" bg-color="#f6f7fa" :index="item.guid" @click="onClick($event,item,index)" @change="swipeChange($event, index)">
<view <view
class="row list-row" class="row list-row"
:data-index="index" :data-index="index"
@longpress="longpress($event, item, index)" @longpress="longpress($event, item, index)"
@touchmove="dragMove" @touchmove="dragMove"
@touchend="dragEnd($enent, item)" @touchend="dragEnd($event, item)"
:class="{ 'ready-place': pageInfo.readyPlaceIndex === index }" :class="{ 'ready-place': pageInfo.readyPlaceIndex === index }"
:id="`item-view-${item.guid}`" :id="`item-view-${item.guid}`"
:style="'height: ' + pageInfo.rowHeight + 'px;'" :style="'height: ' + pageInfo.rowHeight + 'px;'"
@click.stop="closeAll" @click.stop="closeAll"
> >
<view class="item-view"> <view class="item-view" @click.stop="clickCell(item,index)">
<view class="left-view"> <view class="left-view">
<view class="image-view"><image :src="billStaticBaseUrl + item.icon" v-if="item.icon"></image></view> <view class="image-view"><image :src="billStaticBaseUrl + item.icon" v-if="item.icon"></image></view>
<view class="name-view">{{ item.label }}</view> <view class="name-view">{{ item.label }}</view>
</view> </view>
</view> </view>
</view> </view>
</u-swipe-action> </uni-swipe-action-item>
</view> </view>
</uni-swipe-action>
</view> </view>
</scroll-view> </scroll-view>
<movable-area class="movable-area" :style="'display:' + movableViewInfo.showClass + '; height:' + pageInfo.scrollHeight + '%'"> <movable-area class="movable-area" :style="'display:' + movableViewInfo.showClass + '; height:' + pageInfo.scrollHeight + '%'">
...@@ -51,19 +53,23 @@ ...@@ -51,19 +53,23 @@
</template> </template>
<script> <script>
import UniSwipeAction from '@/components/uni-swipe-action/uni-swipe-action.vue';
import UniSwipeActionItem from '@/components/uni-swipe-action-item/uni-swipe-action-item.vue';
import PopInput from '@/components/pop-input-view'; import PopInput from '@/components/pop-input-view';
import { billStaticBaseUrl } from '@/utils/config.js'; import { billStaticBaseUrl } from '@/utils/config.js';
export default { export default {
name: 'dragEdit', name: 'dragEdit',
props: ['list'], props: ['list'],
components: { components: {
PopInput UniSwipeAction,
UniSwipeActionItem,
PopInput,
}, },
data() { data() {
return { return {
billStaticBaseUrl, billStaticBaseUrl,
showConfirm: false, showConfirm: false,
readyDeleteIndex: null, readyDeleteItem: null,
options: [ options: [
{ {
text: '删除', text: '删除',
...@@ -114,45 +120,35 @@ export default { ...@@ -114,45 +120,35 @@ export default {
this.optionLists = [...this.list]; this.optionLists = [...this.list];
}, },
methods: { methods: {
contentClick(e) { clickCell(item) {
console.log('contentClick', e); let flag = true;
setTimeout(() => { this.optionLists.map(el => {
this.closeAll(); if (el.show) {
}, 300); flag = false;
},
handleClick(index, index1) {
let current = this.optionLists.findIndex(item => item.guid === index);
if (index1 == 1) {
this.toEdit(current);
setTimeout(() => {
this.closeAll();
}, 500);
} else {
this.beforeDelete(current);
} }
},
// 如果打开一个的时候,不需要关闭其他,则无需实现本方法
open(index) {
// 先将正在被操作的swipeAction标记为打开状态,否则由于props的特性限制,
// 原本为'false',再次设置为'false'会无效
if (index === null) {
this.optionLists.map((val, idx) => {
this.optionLists[idx].show = false;
}); });
} else { if (flag) {
let current = this.optionLists.findIndex(item => item.guid === index); this.toEdit(item);
this.optionLists[current].show = true; }
this.optionLists.map((val, idx) => { },
if (current !== idx) { onClick(e,item) {
this.optionLists[idx].show = false; console.log(e);
console.log('点击了' + (e.position === 'left' ? '左侧' : '右侧') + e.content.text + '按钮');
if(e.position === 'right'){
if(e.content.text==='删除'){
this.beforeDelete(item)
}else if(e.content.text==='编辑'){
this.toEdit(item);
} }
});
} }
console.log('open', this.optionLists); },
swipeChange(e, index) {
console.log('当前状态:' + e + ',下标:' + index);
this.list[index].show = e === 'right' ? true : false;
}, },
toEdit(index) { toEdit(item) {
let value = this.optionLists[index].label; let value = item.label;
this.$u.route({ this.$u.route({
url: '/pages/mine/input/input', url: '/pages/mine/input/input',
params: { params: {
...@@ -161,22 +157,32 @@ export default { ...@@ -161,22 +157,32 @@ export default {
} }
}); });
uni.$once(`input-sure-payments-setting`, res => { uni.$once(`input-sure-payments-setting`, res => {
this.optionLists[index].label = res.content; this.optionLists.map(el=>{
this.$emit('onEdit', this.optionLists[index]); if(el.id===item.id){
el.label=res.content
}
})
this.$emit('onEdit', item);
}); });
}, },
handleConfirm() { handleConfirm() {
let row = this.optionLists[this.readyDeleteIndex]; this.optionLists.map(item=>{
// this.optionLists.splice(this.readyDeleteIndex, 1); if(item.id===this.readyDeleteItem.id){
this.optionLists[this.readyDeleteIndex].show = false; item.show=false
this.$emit('onDelete', row); }
})
this.$emit('onDelete', this.readyDeleteItem);
}, },
handleCancel() { handleCancel() {
this.optionLists[this.readyDeleteIndex].show = false; this.optionLists.map(item=>{
if(item.id===this.readyDeleteItem.id){
item.show=false
}
})
}, },
beforeDelete(index) { beforeDelete(item) {
this.readyDeleteIndex = index; this.readyDeleteItem = item;
this.showConfirm = true; this.showConfirm = true;
}, },
// 通知父组件修改排序 // 通知父组件修改排序
...@@ -188,7 +194,9 @@ export default { ...@@ -188,7 +194,9 @@ export default {
}, },
closeAll() { closeAll() {
if (this.optionLists.length) { if (this.optionLists.length) {
this.open(null); this.optionLists.map(item=>{
item.show=false
})
} }
}, },
async longpress(event, item) { async longpress(event, item) {
......
...@@ -196,7 +196,6 @@ export default { ...@@ -196,7 +196,6 @@ export default {
try { try {
let {label,id,icon}=row let {label,id,icon}=row
let params={ let params={
name:row.label, name:row.label,
useType:this.form.type useType:this.form.type
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment