Commit 44d24efc authored by 刘文虎's avatar 刘文虎

收据样式,记账统计,备注模板,移除左滑删除/编辑

parent cd26b144
Pipeline #3431 canceled with stages
;(function() { ;(function() {
let NODE_ENV = 'prod' // dev:开发环境 | test:测试环境 | prod:生产环境 let NODE_ENV = 'test' // dev:开发环境 | test:测试环境 | prod:生产环境
let ENV_VAR = null let ENV_VAR = null
let VERSION = 'v1.0.15' let VERSION = 'v1.0.15'
if (process.env.NODE_ENV === 'development') { if (process.env.NODE_ENV === 'development') {
......
import request from "@/utils/request.js"
export function getList(data) {
return request({
url: `/rest/repair/getRemarkTemplate`,
method: 'GET',
data,
noLoading:true
})
}
export function deleteById(data) {
return request({
url: `/remarkTemplate`,
method: 'DELETE',
data
})
}
export function update(data) {
return request({
url: `/rest/repair/RemarkTemplate`,
method: 'POST',
data,
noLoading:true
})
}
\ No newline at end of file
...@@ -40,6 +40,16 @@ export async function repair(data) { ...@@ -40,6 +40,16 @@ export async function repair(data) {
}) })
} }
// 维修账单统计
export async function repairStatistical(data) {
return request({
url: `/rest/repair/statistical`,
method: 'GET',
data,
noLoading: true
})
}
// 导出账单 // 导出账单
export async function repairExport(data) { export async function repairExport(data) {
return request({ return request({
......
<template> <template>
<view style="position: fixed; right: 200%"> <view style="position: fixed; right: 200%">
<l-painter <l-painter isCanvasToTempFilePath @success="success" custom-style="position: fixed; right: 200%">
isCanvasToTempFilePath <l-painter-qrcode :text="url" :css="style"></l-painter-qrcode>
@success="complete" </l-painter>
custom-style="position: fixed; right: 200%" </view>
>
<l-painter-qrcode :text="url" :css="style" />
</l-painter>
</view>
</template> </template>
<script> <script>
export default { export default {
props: { props: {
url: { url: {
type: String, type: String,
default: '', default: ''
}, },
size: { size: {
type: [String, Number], type: [String, Number],
default: 400, default: 400
}, }
}, },
data() { data() {
return {} return {};
}, },
computed: { computed: {
style() { style() {
return `width: ${this.size}rpx;height: ${this.size}rpx` return `width: ${this.size}rpx;height: ${this.size}rpx`;
}, }
}, },
created() { created() {},
}, methods: {
methods: { success(url) {
complete(url) { this.$emit('canvas', url);
this.$emit('canvas', url) }
}, }
}, };
}
</script> </script>
<style lang="scss" scoped></style> <style lang="scss" scoped></style>
...@@ -334,6 +334,15 @@ ...@@ -334,6 +334,15 @@
"enablePullDownRefresh": false "enablePullDownRefresh": false
} }
}
,{
"path" : "choose-remark/choose-remark",
"style" :
{
"navigationBarTitleText": "备注模板",
"enablePullDownRefresh": false
}
} }
] ]
}, },
......
...@@ -2,11 +2,11 @@ ...@@ -2,11 +2,11 @@
<view class="bill-style"> <view class="bill-style">
<view class="bill-style-title">请选择收据样式</view> <view class="bill-style-title">请选择收据样式</view>
<view class="card-item" :class="{ active: item.type === type }" v-for="(item, index) in cardList" :key="index" @click="handleClick(item)"> <view class="card-item" :class="{ active: item.type === type }" v-for="(item, index) in cardList" :key="index" @click="handleClick(item)">
<view class="card-item-icon" @click.stop="preview(item,index)"><image :src="item.icon" mode=""></image></view> <view class="card-item-icon" @click.stop="preview(item, index)"><image :src="item.icon" mode=""></image></view>
<view class="card-item-right"> <view class="card-item-right">
<view class="card-item-right-title"> <view class="card-item-right-title">
<view class="card-item-right-title-name">{{ item.title }}</view> <view class="card-item-right-title-name">{{ item.title }}</view>
<view class="card-item-right-title-preview" @click.stop="preview(item,index)"> <view class="card-item-right-title-preview" @click.stop="preview(item, index)">
<view class="card-item-right-title-preview-icon"><image :src="previewIcon" mode=""></image></view> <view class="card-item-right-title-preview-icon"><image :src="previewIcon" mode=""></image></view>
<view class="card-item-right-title-preview-text">预览</view> <view class="card-item-right-title-preview-text">预览</view>
</view> </view>
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
<script> <script>
import SubmitButton from '@/components/submit-button/index.vue'; import SubmitButton from '@/components/submit-button/index.vue';
import { billBaseUrl } from '@/utils/config.js'; import { billBaseUrl } from '@/utils/config.js';
import { setMaintainBillType, getMaintainBillType } from '@/utils/common.js';
export default { export default {
components: { components: {
SubmitButton SubmitButton
...@@ -30,45 +31,50 @@ export default { ...@@ -30,45 +31,50 @@ export default {
previewIcon: billBaseUrl + 'yulanicon@3x.png', previewIcon: billBaseUrl + 'yulanicon@3x.png',
cardList: [ cardList: [
{ {
type: '1', type: 'receipt',
icon: billBaseUrl + 'fuwuxiaopiaosuolue@3x.png', icon: billBaseUrl + 'fuwuxiaopiaosuolue@3x.png',
image: billBaseUrl + 'weixiuzhangdan-1.png', image: billBaseUrl + 'weixiuzhangdan-1.png',
title: '服务小票', title: '服务小票',
desc: '适用个人用户的常规生活服务场景' desc: '适用个人用户的常规生活服务场景'
}, },
{ {
type: '2', type: 'voucher',
icon: billBaseUrl + 'sgoujupinzhengsuolue@3x.png', icon: billBaseUrl + 'sgoujupinzhengsuolue@3x.png',
image: billBaseUrl + 'dianzipinzheng-1.png', image: billBaseUrl + 'dianzipinzheng-1.png',
title: '收据凭证', title: '收据凭证',
desc: '适用企业用户的服务、售货、报销等场景' desc: '适用企业用户的服务、售货、报销等场景'
} }
], ],
previewImages:[billBaseUrl + 'weixiuzhangdan-1.png',billBaseUrl + 'dianzipinzheng-1.png'], previewImages: [billBaseUrl + 'weixiuzhangdan-1.png', billBaseUrl + 'dianzipinzheng-1.png'],
type: '1' type: 'receipt'
}; };
}, },
onReady() {
this.type = getMaintainBillType() || 'receipt';
},
methods: { methods: {
handleClick(item) { handleClick(item) {
this.type = item.type; this.type = item.type;
}, },
preview(item,index) { preview(item, index) {
// 预览图片 // 预览图片
uni.previewImage({ uni.previewImage({
urls: this.previewImages, urls: this.previewImages,
current:index, current: index,
longPressActions: { longPressActions: {
itemList: ['发送给朋友', '保存图片', '收藏'], success: function(data) {},
success: function(data) {
console.log('选中了第' + (data.tapIndex + 1) + '个按钮,第' + (data.index + 1) + '张图片');
},
fail: function(err) { fail: function(err) {
console.log(err.errMsg); console.log(err.errMsg);
} }
} }
}); });
}, },
submit() {} submit() {
setMaintainBillType(this.type)
uni.navigateTo({
url: `/pages/maintain-bill/create?type=${this.type}`
});
}
} }
}; };
</script> </script>
......
<template>
<!-- 收支设置 -->
<view class="column-administer">
<view class="content-view">
<!-- 拖动 -->
<view class="drap-view">
<NoData v-if="noData" :text="noDataText" customStyle="margin-top: 0rpx;" :imageName="noDataImage" />
<drap-view v-else ref="drap-view" :list="list" @choose="choose" @onEdit="onEdit" @onDelete="onDelete" ></drap-view>
</view>
<view class="submit"><ab-button content="创建模板" :customStyle="customStyle" left-icon="plus" @click="toAdd"></ab-button></view>
</view>
<u-toast ref="uToast" />
</view>
</template>
<script>
import NavbarNormal from '@/components/navbar-normal';
import DrapView from './components/drap-view.vue';
import AbButton from '@/components/common/ab-button.vue';
import NoData from '@/components/no-data';
import { getList, update } from '@/api/maintain/choose-remark.js';
export default {
name: 'column-administer',
components: {
NavbarNormal,
DrapView,
AbButton,
NoData
},
data() {
return {
noDataText: '当前暂无内容',
noDataImage: 'bill/wuzhangdanneirong@3x.png',
customStyle: {
height: '104rpx',
'font-size': '32rpx'
},
list: [],
editType: 'create-remark',
chooseType:'maintain-bill-choose-remark'
};
},
computed: {
noData() {
return (this.list || []).length == 0 && this.loaded;
}
},
onLoad(options) {
this.getList();
},
onReady() {},
onUnload() {
uni.$off(`input-sure-${this.editType}`);
uni.$off(this.chooseType);
},
methods: {
choose(item){
uni.$emit(this.chooseType,item);
this.$u.route({
type: 'back'
});
},
toAdd() {
this.$u.route({
url: '/pages/mine/input/input',
params: {
type: this.editType,
value: '',
whiteSpace:true,
}
});
uni.$once(`input-sure-${this.editType}`, res => {
this.onEdit({label:res.content});
});
},
async getList() {
this.loaded = false;
try {
let { data } = await getList();
data.forEach(item => {
item.label = item.remark;
});
this.list = data || [];
} catch (e) {
//TODO handle the exception
}
this.loaded = true;
},
async onDelete(row) {
try {
let params = {
id: row.id,
sortValue:0,
deleteFlag: true
};
let res = await update(params);
await this.getList();
} catch (e) {
this.getList();
//TODO handle the exception
}
},
async onEdit(row) {
try {
let { label, id } = row;
let params = {
remark: label,
sortValue:0,
deleteFlag: false
};
if (id) {
params = {
...params,
id: id
};
}
let res = await update(params);
await this.getList();
} catch (e) {
this.getList();
//TODO handle the exception
}
}
}
};
</script>
<style scoped lang="scss">
.column-administer {
background: #f6f7fa;
padding: 24rpx;
height: 100vh;
width: 100%;
display: flex;
flex-direction: column;
.content-view {
flex: 1;
width: 100%;
display: flex;
flex-direction: column;
.drap-view {
flex: 1;
width: 100%;
position: relative;
// height: 500rpx;
}
.button-view {
display: flex;
align-items: center;
width: 360upx;
// height: 72upx;
background: #ffffff;
border-radius: 12upx;
border: 4upx solid #ffffff;
margin-bottom: 24upx;
&-item {
width: 176upx;
height: 64upx;
font-size: 28upx;
color: #8d8d8d;
display: flex;
align-items: center;
justify-content: center;
}
&-active {
background: #02a074;
border-radius: 12upx;
color: #ffffff;
font-weight: bold;
}
}
}
.submit {
margin: 36upx 0;
}
}
</style>
<template>
<!-- 拖动 -->
<view class="edit-box" :style="{ top: 0 }">
<view class="zhuti">
<scroll-view :scroll-y="pageInfo.scrollY" class="product-section">
<view class="list">
<view class="swipe-action-outside" v-for="(item, index) in optionLists" :key="item.id">
<view
class="row list-row"
:data-index="index"
:class="{ 'ready-place': pageInfo.readyPlaceIndex === index }"
:id="`item-view-${item.id}`"
:style="'height: ' + pageInfo.rowHeight + 'px;'"
>
<view class="item-view" @click="choose(item, index)">
<view class="left-view">
<view class="name-view ellipsis-2">{{ item.label }}</view>
</view>
<view class="right-view" @click.stop="clickCell(item, index)"><u-icon name="edit-pen"></u-icon></view>
</view>
</view>
</view>
</view>
</scroll-view>
</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 { billBaseUrl } from '@/utils/config.js';
import { mapGetters } from 'vuex';
export default {
name: 'dragEdit',
props: ['list'],
components: {
PopInput
},
data() {
return {
billBaseUrl,
showConfirm: false,
readyDeleteItem: null,
optionLists: [],
pageInfo: {
scrollY: true, // 当为true时拖动单条,整个大盒子不会滚动
rowHeight: 66, // 单条行高
scrollHeight: 100, // 拖动时行高,百分比
startIndex: null, // 当前拖动第几条
startY: 0, // 定位拖动时的位置,需要减去上方空白部分
readyPlaceIndex: null, // 拖动预放置位置,拖动时有阴影的部分
selectedIndex: null, // 放置的位置
beginMove: false
},
top: 0,
editType: 'create-remark',
deleteType: 'remark-sure-delete'
};
},
watch: {
list: {
handler(val) {
this.optionLists = [...val];
},
immediate: true,
deep: true
}
},
computed: {
...mapGetters(['platform', 'systemInfo'])
},
mounted() {
this.optionLists = [...this.list];
},
beforeDestroy() {
uni.$off(`input-sure-${this.editType}`);
uni.$off(this.deleteType);
},
methods: {
clickCell(item) {
this.toEdit(item);
},
choose(item){
this.$emit('choose', item);
},
toEdit(item) {
let value = item.label;
this.$u.route({
url: '/pages/mine/input/input',
params: {
type: this.editType,
deleteType: this.deleteType,
whiteSpace:true,
value: encodeURIComponent(value),
id: item.id
}
});
uni.$once(`input-sure-${this.editType}`, res => {
this.optionLists.map(el => {
if (el.id === item.id) {
el.label = res.content;
}
});
this.$emit('onEdit', item);
});
uni.$once(this.deleteType, res => {
this.optionLists.map(el => {
if (el.id === item.id) {
this.beforeDelete(el);
}
});
});
},
handleConfirm() {
this.$emit('onDelete', this.readyDeleteItem);
},
handleCancel() {},
beforeDelete(item) {
this.readyDeleteItem = item;
this.showConfirm = true;
}
}
};
</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%;
height: 100%;
position: absolute;
top: 0;
bottom: 0;
left: 0;
overflow: scroll;
}
.row {
height: 66px;
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%;
visibility: hidden;
height: 0;
}
.movable-area-active {
visibility: unset;
display: inline-block;
height: 100%;
// display: block;
}
.movable-row {
// visibility: hidden;
height: 0;
.item-view {
}
}
.movable-row-active {
box-shadow: #d9d9d9 0 0 20px;
// visibility: unset;
height: 66px;
}
.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: 80%;
height: 100%;
.name-view {
font-size: 24rpx;
line-height: 32rpx;
}
}
.right-view {
height: 100%;
display: flex;
align-items: center;
margin-left: 40rpx;
font-size: 36rpx;
}
}
</style>
<template> <template>
<view class="bill-count"> <view class="bill-count">
<view class="bill-count-item" v-for="(item, index) in list" :key="index"> <view class="bill-count-item" v-for="(item, index) in list" :key="index">
<view class="bill-count-item-value ellipsis " :class="{red:detail[item.value]>0}">{{ detail[item.value] }}</view> <view class="bill-count-item-value " >
<text class="red" v-if="item.value === 'arearAmount'">{{ arearAmount }}</text>
<text v-else>{{ keepWFull(detail[item.value]) }}</text>
</view>
<view class="bill-count-item-label">{{ item.label }}</view> <view class="bill-count-item-label">{{ item.label }}</view>
<view class="bill-count-item-line" v-if="index !== list.length - 1"></view> <view class="bill-count-item-line" v-if="index !== list.length - 1"></view>
</view> </view>
...@@ -10,17 +13,24 @@ ...@@ -10,17 +13,24 @@
<script> <script>
import { billCountOptions } from '@/utils/options/maintain-bill/index.js'; import { billCountOptions } from '@/utils/options/maintain-bill/index.js';
import { keepWFull } from '@/utils/common.js';
export default { export default {
props:{ props: {
detail:{ detail: {
type:Object, type: Object,
default:()=>{} default: () => {}
}
},
computed: {
arearAmount() {
let { receivableAmount, actualAmount } = this.detail;
return keepWFull(parseFloat(receivableAmount)-parseFloat(actualAmount))
} }
}, },
data() { data() {
return { return {
list: billCountOptions, keepWFull,
list: billCountOptions
}; };
} }
}; };
...@@ -29,17 +39,23 @@ export default { ...@@ -29,17 +39,23 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
.bill-count { .bill-count {
// height: 160upx; // height: 160upx;
width: 100%;
display: flex; display: flex;
align-items: center;
padding-top: 32rpx; padding-top: 32rpx;
&-item { &-item {
width: 25%; width: 25%;
height: 100%; height: 100%;
padding: 0 12upx; padding: 0 6upx;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
position: relative; position: relative;
overflow: hidden;
&:first-child{
// width: 16%;
}
&-value { &-value {
width: 100%; width: 100%;
text-align: center; text-align: center;
...@@ -48,21 +64,21 @@ export default { ...@@ -48,21 +64,21 @@ export default {
font-size: 28upx; font-size: 28upx;
font-weight: bold; font-weight: bold;
} }
.red{ .red {
color: #FC524D; color: #fc524d;
} }
&-label { &-label {
font-size: 24upx; font-size: 24upx;
color: #8d8d8d; color: #8d8d8d;
} }
&-line{ &-line {
position: absolute; position: absolute;
right: 0; right: 0;
top: 50%; top: 50%;
transform: translateY(-50%); transform: translateY(-50%);
width: 2upx; width: 2upx;
height: 32upx; height: 32upx;
background: #F6F7FA; background: #f6f7fa;
} }
} }
} }
......
<template> <template>
<uni-popup v-model="show" ref="uniPopup" border-radius="24" :custom-style="customStyle" type="center" height="70%"> <uni-popup v-model="show" ref="uniPopup" border-radius="24" :custom-style="customStyle" type="center" height="70%">
<view class="receipt-preview"> <view class="receipt-preview" :class="{ type1: type === 'receipt' }">
<view class="head-background"><!-- 背景 --></view> <view class="head-background"><!-- 背景 --></view>
<!-- #ifdef APP-PLUS --> <!-- #ifdef APP-PLUS -->
<scroll-view scroll-y="true" show-scrollbar class="scroll-Y"> <scroll-view scroll-y="true" show-scrollbar class="scroll-Y">
...@@ -44,12 +44,14 @@ export default { ...@@ -44,12 +44,14 @@ export default {
components: { components: {
UniPopup UniPopup
}, },
props: ['type'],
data() { data() {
return { return {
show: true, show: true,
arrowUrl: billBaseUrl + 'baojiashunxu@3x.png', arrowUrl: billBaseUrl + 'baojiashunxu@3x.png',
steps: quotedPriceSteps, steps: quotedPriceSteps,
previewImage: billBaseUrl + 'weixiuzhangdan-1.png', previewImage1: billBaseUrl + 'weixiuzhangdan-1.png',
previewImage2: billBaseUrl + 'sgoujupinzhengsuolue@3x.png',
closeIcon: billBaseUrl + 'guanbitanchuang@3x.png', closeIcon: billBaseUrl + 'guanbitanchuang@3x.png',
customStyle: { customStyle: {
// 'margin-top': '90rpx', // 'margin-top': '90rpx',
...@@ -57,6 +59,11 @@ export default { ...@@ -57,6 +59,11 @@ export default {
} }
}; };
}, },
computed: {
previewImage() {
return this.type === 'receipt' ? this.previewImage1 : this.previewImage2;
}
},
methods: { methods: {
open() { open() {
this.show = true; this.show = true;
...@@ -65,6 +72,18 @@ export default { ...@@ -65,6 +72,18 @@ export default {
close() { close() {
this.show = false; this.show = false;
this.$refs.uniPopup.close(); this.$refs.uniPopup.close();
},
preview(item, index) {
// 预览图片
uni.previewImage({
urls: [this.previewImage],
longPressActions: {
success: function(data) {},
fail: function(err) {
console.log(err.errMsg);
}
}
});
} }
} }
}; };
...@@ -76,7 +95,7 @@ export default { ...@@ -76,7 +95,7 @@ export default {
background-color: #ffffff; background-color: #ffffff;
color: #333333; color: #333333;
// height: 100%; // height: 100%;
height: 1100rpx; height: 720rpx;
width: 622rpx; width: 622rpx;
padding: 24rpx 16rpx 24rpx 24rpx; padding: 24rpx 16rpx 24rpx 24rpx;
// display: flex; // display: flex;
...@@ -167,7 +186,7 @@ export default { ...@@ -167,7 +186,7 @@ export default {
.preview { .preview {
width: 100%; width: 100%;
min-height: 1800rpx; // min-height: 1800rpx;
&-image { &-image {
width: 100%; width: 100%;
} }
...@@ -208,4 +227,7 @@ export default { ...@@ -208,4 +227,7 @@ export default {
} }
} }
} }
.type1 {
height: 1100rpx;
}
</style> </style>
<template>
<view class="voucher">
<view class="voucher-title">
<view class="voucher-title-text">
<text>{{ stopInfo.name }}</text>
<view class="voucher-title-text-underline"></view>
</view>
</view>
<view class="voucher-head">
<view class="voucher-head-item" v-for="(item, index) in voucherHeadOptions" :key="index">
<view class="voucher-head-item-label">
<text>{{ item.label }}</text>
<text>:</text>
</view>
<view class="voucher-head-item-value">
<text v-if="item.value === 'customer'">{{ detail[item.value][item.childrenValue] || '' }}</text>
<text v-else>{{ detail[item.value] || '' }}</text>
</view>
</view>
</view>
<view class="voucher-table">
<view class="voucher-table-tr" style="border-top: none">
<view class="voucher-table-th" :style="{ width: item.width }" v-for="(item, index) in tableCellOptions" :key="index">{{ item.label }}</view>
<view class="voucher-table-th" style="width: 128rpx;">备注/说明</view>
</view>
<view class="voucher-table-tbody">
<view class="voucher-table-tbody-content">
<view class="voucher-table-tr" v-for="(detailItem, detailIndex) in expenseArray" :key="detailIndex">
<view class="voucher-table-td" :style="{ width: item.width }" v-for="(item, index) in tableCellOptions" :key="index">
<text>{{ (detailItem.id && item.currencySign) || '' }}</text>
<text v-if="index === 0">{{ detailIndex + 1 }}</text>
<text v-else>{{ detailItem[item.value] || '' }}</text>
</view>
</view>
</view>
<view class="voucher-table-tbody-remark" :style="{ height: '100%' }"><text v-text="detail.remark"></text></view>
</view>
<view class="voucher-table-tfooter">
<view class="voucher-table-td voucher-table-tfooter-col-label" style="width: 44rpx;">合计</view>
<view class="voucher-table-td" style="width: 597rpx;">
<view class="voucher-table-tfooter-col">
<view class="voucher-table-tfooter-col-left">
<text class="voucher-table-tfooter-col-label">大写金额:</text>
<text>{{ upperCase }}</text>
</view>
<view class="voucher-table-tfooter-col-right">
<text class="voucher-table-tfooter-col-label">(小写):</text>
<text>¥{{ keepTwoDecimalFull(expenseCount) }}</text>
</view>
</view>
</view>
</view>
<view class="voucher-table-declare">本收据为电子凭证 , 具有同等效力</view>
</view>
<view class="voucher-head voucher-footer">
<view class="voucher-head-item voucher-footer-item" v-for="(item, index) in voucherFooterOptions" :key="index">
<view class="voucher-head-item-label">
<text>{{ item.label }}</text>
<text>:</text>
</view>
<view class="voucher-head-item-value">
<text>{{ item.currencySign || '' }}</text>
<text v-if="item.value === 'stopInfo'">{{ stopInfo[item.childrenValue] || '' }}</text>
<text v-else-if="item.value === 'arearAmount'">{{ arearAmount }}</text>
<text v-else>{{ detail[item.value] || '' }}</text>
</view>
</view>
</view>
<view class="voucher-preview" hover-class="u-hover-class" @click="preview">
<view class="voucher-preview-icon"><image :src="previewIcon" mode=""></image></view>
<text>点击查看大图</text>
</view>
</view>
</template>
<script>
import { voucherHeadOptions, voucherFooterOptions, tableCellOptions, canvasTableCellOptions, tableFooterOptions } from '@/utils/options/maintain-bill/index.js';
import { billBaseUrl } from '@/utils/config.js';
import { convertCurrency, keepTwoDecimalFull } from '@/utils/common.js';
export default {
props: {
detail: {
type: Object,
default: () => {
return {
expenseDetails: []
};
}
},
stopInfo: {
type: Object,
default: () => {}
}
},
data() {
return {
keepTwoDecimalFull,
voucherHeadOptions,
voucherFooterOptions,
tableCellOptions,
canvasTableCellOptions,
tableFooterOptions,
previewIcon: billBaseUrl + 'yulanicon@3x.png',
// detail: {
// expenseDetails: [{ expense: '123' }, { expense: '123' }, { expense: '123' }],
// remark:'备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注客户地'
// },
poster: null
};
},
computed: {
expenseArray() {
let length = 5 - this.detail.expenseDetails.length;
length = length > 0 ? length : 0;
let arr = this.detail.expenseDetails || [];
for (let i = 0; i < length; i++) {
arr.push({});
}
return arr;
},
arearAmount() {
let { receivableAmount, actualAmount } = this.detail;
return parseFloat(receivableAmount) - parseFloat(actualAmount);
},
expenseCount() {
if (this.detail.expenseDetails && this.detail.expenseDetails.length) {
let num = 0;
this.detail.expenseDetails.map(item => {
num += parseFloat(item.total);
});
return num;
}
return 0;
},
upperCase() {
return convertCurrency(this.expenseCount);
}
},
methods: {
handleSaveVoucher() {
this.saveVoucher();
this.$emit('save', this.poster);
},
preview() {
if (!this.poster) {
this.saveVoucher();
}
this.$emit('preview', this.poster);
},
saveVoucher() {
let scale = 1;
let orangeColor = '#eb872f';
let orangeBorderCss = '1rpx solid ' + orangeColor;
let borderCss = '2rpx solid #eeeeee';
let trCss = {
width: '100%',
height: '36rpx',
lineHeight: '36rpx',
'border-top': borderCss
};
let thCss = {
height: '100%',
color: orangeColor,
padding: '0 4rpx',
'border-right': borderCss,
lineClamp: 1,
display: 'inline-block',
textAlign: 'center'
};
let tdCss = {
height: '100%',
color: '#333333',
padding: '0 4rpx',
lineClamp: 1,
'border-right': borderCss,
display: 'inline-block',
textAlign: 'center'
};
let headView = this.voucherHeadOptions.map((item, index) => {
let view = {
type: 'view',
css: {
width: '30%',
display: 'inline-block',
fontSize: '14rpx',
lineHeight: '22rpx',
'margin-bottom': '4rpx'
},
views: [
{
type: 'view',
css: {
display: 'inline'
},
views: [
{
type: 'text',
css: {
color: orangeColor
},
text: `${item.label}:`
},
{
type: 'text',
css: {
color: '#333333'
},
text: item.value === 'customer' ? this.detail[item.value][item.childrenValue] || '' : this.detail[item.value] || ''
}
]
}
]
};
if (index === this.voucherHeadOptions.length - 1) {
view.css.width = '70%';
}
return view;
});
let tableTr = this.canvasTableCellOptions.map(item => {
let view = {
type: 'view',
css: {
...thCss,
width: item.width
},
views: [
{
type: 'text',
css: {},
text: item.label
}
]
};
return view;
});
tableTr.push({
type: 'view',
css: {
...thCss,
width: `${106 * scale}rpx`,
borderRight: 'none'
},
views: [
{
type: 'text',
text: '备注/说明'
}
]
});
let tableBodyLeft = this.expenseArray.map((el, i) => {
let views = this.canvasTableCellOptions.map((item, index) => {
let view = {
type: 'view',
css: {
...tdCss,
width: item.width,
display: 'inline-block'
},
views: [
{
type: 'text',
css: {},
text: (el.id && item.currencySign) || ''
},
{
type: 'text',
css: {
lineClamp: 1
},
text: index === 0 ? i + 1 : el[item.value] || ''
}
]
};
if (index === this.canvasTableCellOptions.length) {
view.css['border-right'] = borderCss;
}
return view;
});
let view = {
type: 'view',
css: {
...trCss
},
views: views
};
if (i === 0) {
view.css['border-top'] = 'none';
}
return view;
});
console.log('tableBodyLeft', tableBodyLeft);
let tableBody = [
{
type: 'view',
css: {
width: `${582 * scale}rpx`,
display: 'inline-block'
},
views: tableBodyLeft
},
{
type: 'view',
css: {
display: 'inline-block',
width: `${110 * scale}rpx`,
height: `${(this.expenseArray.length - 1) * 36}rpx`,
padding: '0 4rpx'
},
views: [
{
type: 'text',
'line-clamp': 6,
text: this.detail.remark
}
]
}
];
let tableFooterCell = this.tableFooterOptions.map((item, index) => {
let text = item.value === 'upperCase' ? this.upperCase : this.keepTwoDecimalFull(this.expenseCount);
if (item.value === 'lowerCase' && text) {
text = '¥' + text;
}
let view = {
type: 'view',
css: {
width: item.width
},
views: [
{
type: 'text',
css: {
color: orangeColor
},
text: item.label
},
{
type: 'text',
text: text
}
]
};
return view;
});
let tableFooter = [
{
type: 'view',
css: {
...tdCss,
'border-bottom': 'none',
lineHeight: '36rpx',
width: '48rpx'
},
views: [
{
type: 'text',
text: '合计'
}
]
},
{
type: 'view',
css: {
...tdCss,
'border-bottom': 'none',
borderRight: 'none',
width: '652rpx',
display: 'flex',
'align-items': 'center',
'text-align': 'left',
'padding-left': '16rpx'
},
views: tableFooterCell
}
];
let tableView = [
// 表头
{
type: 'view',
css: {
...trCss,
'border-top': 'none'
},
views: tableTr
},
// 表格tbody
{
type: 'view',
css: {
width: '100%',
'border-top': borderCss
},
views: tableBody
},
// 表格合计
{
type: 'view',
css: {
width: '100%',
height: '36rpx',
display: 'flex',
'align-items': 'center',
'border-top': borderCss,
borderRight: 'none'
},
views: tableFooter
},
// 表格右侧说明
{
type: 'view',
css: {
position: 'absolute',
right: '-24rpx',
top: '-18rpx',
width: '9rpx',
fontSize: '10rpx',
lineHeight: '16rpx',
'text-align': 'center',
color: orangeColor
},
views: [
{
type: 'text',
text: '本收据为电子凭证,具有同等效力'
}
]
}
];
// 表格底部
let footerView = this.voucherFooterOptions.map((item, index) => {
let text = item.value === 'stopInfo' ? this.stopInfo[item.childrenValue] : item.value === 'arearAmount' ? this.arearAmount : this.detail[item.value];
let view = {
type: 'view',
css: {
width: '25%',
display: 'inline-block',
fontSize: '14rpx',
lineHeight: '22rpx',
'margin-bottom': '4rpx'
},
views: [
{
type: 'view',
css: {
display: 'inline'
},
views: [
{
type: 'text',
css: {
color: orangeColor
},
text: `${item.label}:`
},
{
type: 'text',
css: {
color: '#333333'
},
text: `${item.currencySign || ''}${text || ''}`
}
]
}
]
};
// <text>{{item.currencySign||""}}</text>
// <text v-if="item.value === 'stopInfo'">{{ stopInfo[item.childrenValue] || '' }}</text>
// <text v-else-if="item.value==='arearAmount'">{{ arearAmount }}</text>
// <text v-else>{{ detail[item.value] || '' }}</text>
if (index === this.voucherFooterOptions.length - 1) {
view.css.width = '75%';
}
return view;
});
console.log(tableView);
this.poster = {
css: {
width: `${750 * scale}rpx`,
'background-color': '#FFFFFF',
padding: '24rpx 16rpx',
color: '#333333'
},
views: [
// 标题
{
type: 'view',
css: {
position: 'absolute',
top: '-20rpx',
width: '702rpx',
display: 'flex',
justifyContent: 'center'
},
views: [
{
type: 'view',
css: {
display: 'inline-block'
},
views: [
{
type: 'text',
css: {
display: 'inline-block',
fontSize: '24rpx',
textAlign: 'center',
'font-weight': 'bold',
color: orangeColor,
'line-height': '52rpx'
},
text: this.stopInfo.name
},
{
type: 'text',
css: {
display: 'block',
'margin-top': '4rpx',
// fontSize: '0rpx',
fontSize: '24rpx',
'font-weight': 'bold',
height: '4rpx',
'border-top': orangeBorderCss,
'border-bottom': orangeBorderCss,
color: 'rgba(255,255,255,0)'
},
text: this.stopInfo.name
}
]
}
]
},
// 头部信息
{
type: 'view',
css: {
'margin-top': '60rpx',
// display: 'flex',
// 'flex-wrap': 'wrap',
overflow: 'hidden'
},
views: headView
},
// 表格
{
type: 'view',
css: {
width: '702rpx',
fontSize: '14rpx',
lineHeight: '22rpx',
textAlign: 'left',
marginTop: '6rpx',
border: borderCss
},
views: tableView
},
// 底部信息
{
type: 'view',
css: {
'margin-top': '10rpx',
overflow: 'hidden'
},
views: footerView
}
]
};
}
}
};
</script>
<style lang="scss" scoped>
// 橙色字体
$orange-color: #eb872f;
.voucher {
padding: 24rpx 16rpx;
background-color: #ffffff;
border-radius: 16rpx;
color: #333333;
&-title {
display: flex;
justify-content: center;
align-items: center;
font-size: 24rpx;
font-weight: bold;
color: $orange-color;
line-height: 52rpx;
&-text {
// display: flex;
display: inline-block;
position: relative;
&-underline {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 6rpx;
border-top: 2rpx solid $orange-color;
border-bottom: 2rpx solid $orange-color;
}
}
}
&-head {
margin-top: 16rpx;
display: flex;
flex-wrap: wrap;
overflow: hidden;
&-item {
width: 30%;
display: flex;
align-items: center;
font-size: 14rpx;
line-height: 22rpx;
margin-bottom: 4rpx;
&:last-child {
width: 70%;
white-space: nowrap;
overflow: hidden;
word-break: break-all;
}
&-label {
color: $orange-color;
}
}
}
&-footer {
margin-top: 10rpx;
&-item {
width: 25%;
&:last-child {
width: 75%;
white-space: nowrap;
overflow: hidden;
word-break: break-all;
}
}
}
&-table {
width: 650rpx;
font-size: 14rpx;
line-height: 22rpx;
text-align: center;
margin-top: 6rpx;
border: 2rpx solid #cccccc;
position: relative;
&-tr {
width: 100%;
display: flex;
align-items: center;
height: 34rpx;
border-top: 2rpx solid #cccccc;
}
&-th {
height: 100%;
color: $orange-color;
padding: 4rpx 4rpx;
border-right: 2rpx solid #cccccc;
white-space: nowrap;
overflow: hidden;
word-break: break-all;
&:last-child {
border-right: none;
}
}
&-td {
height: 100%;
padding: 4rpx 4rpx;
border-right: 2rpx solid #cccccc;
white-space: nowrap;
overflow: hidden;
word-break: break-all;
&:last-child {
border-right: none;
}
}
&-tbody {
width: 100%;
display: flex;
align-items: flex-start;
&-content {
.voucher-table-tr {
.voucher-table-td {
&:last-child {
border-right: 2rpx solid #cccccc;
}
}
}
}
&-remark {
flex: 1;
height: 100%;
padding: 4rpx 4rpx;
border-top: 2rpx solid #cccccc;
overflow: hidden;
text-align-last: left;
display: -webkit-box;
-webkit-line-clamp: 7;
line-clamp: 7;
-webkit-box-orient: vertical;
}
}
&-tfooter {
height: 34rpx;
display: flex;
align-items: center;
border-top: 2rpx solid #cccccc;
.voucher-table-td {
border-bottom: none;
}
&-col {
display: flex;
align-items: center;
text-align: left;
padding-left: 16rpx;
&-left {
width: 70%;
}
&-right {
width: 30%;
}
}
&-col-label {
color: $orange-color;
}
}
&-declare {
position: absolute;
right: -24rpx;
top: 0;
width: 9rpx;
font-size: 10rpx;
line-height: 16rpx;
text-align: center;
color: $orange-color;
}
}
&-preview {
margin-top: 28rpx;
font-size: 24rpx;
color: $default-color;
display: flex;
justify-content: center;
align-items: center;
&-icon {
width: 32rpx;
height: 24rpx;
margin-right: 8rpx;
}
}
}
</style>
...@@ -108,7 +108,12 @@ ...@@ -108,7 +108,12 @@
</view> </view>
<view class="line-view"></view> <view class="line-view"></view>
<view class="item-view" style="display: block"> <view class="item-view" style="display: block">
<view class="lable-view">备注信息</view> <view class="lable-view remark-view">
<text>备注信息</text>
<view class="remark-view-add" hover-class="u-hover-class" @click="chooseRemark">
选模板
</view>
</view>
<view class="value-view area-view"> <view class="value-view area-view">
<u-input <u-input
type="textarea" type="textarea"
...@@ -141,7 +146,7 @@ ...@@ -141,7 +146,7 @@
</view> </view>
<view class="loading-view" v-if="loading"><u-loading mode="flower"></u-loading></view> <view class="loading-view" v-if="loading"><u-loading mode="flower"></u-loading></view>
<u-picker confirm-color="#02A074" mode="time" v-model="showTimePicker" :default-time="form.repairTime" :params="pickerParams" safe-area-inset-bottom @confirm="handleComfirmTime"></u-picker> <u-picker confirm-color="#02A074" mode="time" v-model="showTimePicker" :default-time="form.repairTime" :params="pickerParams" safe-area-inset-bottom @confirm="handleComfirmTime"></u-picker>
<receipt-preview ref="receipt-preview"></receipt-preview> <receipt-preview :type="form.type" ref="receipt-preview"></receipt-preview>
<u-toast ref="uToast" /> <u-toast ref="uToast" />
</view> </view>
</template> </template>
...@@ -180,7 +185,8 @@ export default { ...@@ -180,7 +185,8 @@ export default {
latitude: '', latitude: '',
longitude: '', longitude: '',
remark: '', remark: '',
attach: [] attach: [],
type:'', // 收据样式
}, },
showDatePicker: false, showDatePicker: false,
showTimePicker: false, showTimePicker: false,
...@@ -299,6 +305,9 @@ export default { ...@@ -299,6 +305,9 @@ export default {
if (options && options.billId) { if (options && options.billId) {
this.billId = options.billId; this.billId = options.billId;
} }
if (options && options.type) {
this.form.type = options.type;
}
this.freshing = false; this.freshing = false;
if (this.billId) { if (this.billId) {
...@@ -314,6 +323,7 @@ export default { ...@@ -314,6 +323,7 @@ export default {
}, },
onUnload() { onUnload() {
uni.$off('maintain-bill-detail') uni.$off('maintain-bill-detail')
uni.$off('maintain-bill-choose-remark')
}, },
onShow() {}, onShow() {},
methods: { methods: {
...@@ -323,6 +333,14 @@ export default { ...@@ -323,6 +333,14 @@ export default {
preview() { preview() {
this.$refs['receipt-preview'].open(); this.$refs['receipt-preview'].open();
}, },
chooseRemark(){
uni.$on('maintain-bill-choose-remark',res=>{
this.form.remark=res.remark
})
uni.navigateTo({
url:'/pages/maintain-bill/choose-remark/choose-remark'
})
},
async getAddress() { async getAddress() {
if (this.platform !== '4') { if (this.platform !== '4') {
getSetting('scope.userLocation', '检测到您没打开获取位置权限,该信息将用于获取所在位置,是否去设置打开?', res => { getSetting('scope.userLocation', '检测到您没打开获取位置权限,该信息将用于获取所在位置,是否去设置打开?', res => {
...@@ -377,6 +395,7 @@ export default { ...@@ -377,6 +395,7 @@ export default {
longitude: data.longitude, longitude: data.longitude,
remark: data.remark, remark: data.remark,
attach: data.attach, attach: data.attach,
type: data.type, // 收据样式
// 编辑情况下,下一页的数据 // 编辑情况下,下一页的数据
expenseDetails: data.expenseDetails, expenseDetails: data.expenseDetails,
...@@ -617,6 +636,23 @@ export default { ...@@ -617,6 +636,23 @@ export default {
} }
} }
} }
.remark-view{
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
.remark-view-add {
font-size: 20rpx;
color: #FFFFFF;
line-height: 40rpx;
text-align: center;
width: 92rpx;
height: 40rpx;
background: $default-color;
border-radius: 8rpx;
}
}
.area-view { .area-view {
margin: 24rpx 0; margin: 24rpx 0;
......
...@@ -81,7 +81,7 @@ import FabView from '@/components/fab-view'; ...@@ -81,7 +81,7 @@ import FabView from '@/components/fab-view';
import NoData from '@/components/no-data'; import NoData from '@/components/no-data';
import PopExport from '@/components/pop-export-bill'; import PopExport from '@/components/pop-export-bill';
import BillCount from './components/bill-count.vue'; import BillCount from './components/bill-count.vue';
import { repair } from '@/api/maintain/index.js'; import { repair,repairStatistical } from '@/api/maintain/index.js';
export default { export default {
components: { components: {
...@@ -109,9 +109,9 @@ export default { ...@@ -109,9 +109,9 @@ export default {
current: 1, current: 1,
size: 10, size: 10,
statistics:{ statistics:{
income:0, number:0,
expense:0, actualAmount:0,
surplus:0, receivableAmount:0
} }
}; };
}, },
...@@ -186,6 +186,7 @@ export default { ...@@ -186,6 +186,7 @@ export default {
this.current = 1; this.current = 1;
this.loadStatus = 'loading'; this.loadStatus = 'loading';
this.getMyDynamic(); this.getMyDynamic();
this.getBillStatistical()
}, },
getMyDynamic() { getMyDynamic() {
if (this.current == 1) { if (this.current == 1) {
...@@ -226,6 +227,22 @@ export default { ...@@ -226,6 +227,22 @@ export default {
console.log(err); console.log(err);
}); });
}, },
getBillStatistical() {
repairStatistical({
start: this.start,
end: this.end,
keyword: this.keyword,
onlyDebt: this.onlyDebt,
customerId:this.customerId
})
.then(res => {
let data = res.data;
this.statistics=data
})
.catch(err => {
console.log(err);
});
},
onRefresh() { onRefresh() {
if (this.freshing) return; if (this.freshing) return;
this.freshing = true; this.freshing = true;
...@@ -265,7 +282,7 @@ export default { ...@@ -265,7 +282,7 @@ export default {
}, },
handleClickFab() { handleClickFab() {
this.$u.route({ this.$u.route({
url: 'pages/maintain-bill/create', url: 'pages/maintain-bill/bill-style',
params: {} params: {}
}); });
}, },
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
titleColor="#FFFFFF" titleColor="#FFFFFF"
backIconColor="#FFFFFF" backIconColor="#FFFFFF"
:background="{ :background="{
'background-color': '#02A074' 'background-color': info.type === 1 ? '#02A074' : ''
}" }"
title="服务账单" title="服务账单"
/> />
...@@ -16,7 +16,8 @@ ...@@ -16,7 +16,8 @@
<view class="top-view"></view> <view class="top-view"></view>
<view class="content-view"> <view class="content-view">
<scroll-view scroll-y="true" style="height:100%"> <scroll-view scroll-y="true" style="height:100%">
<view class="scroll-view>"> <view class="scroll-view" v-if="info.type === 'voucher'"><show-voucher ref="show-voucher" :detail="info" :stopInfo="stopInfo" @save="savePoster" @preview="previewPoster"></show-voucher></view>
<view class="scroll-view>" v-else>
<view class="info-view part-view"> <view class="info-view part-view">
<view class="title-view">账单信息</view> <view class="title-view">账单信息</view>
<view class="list-view" v-for="(item, key) in infoKeys" :key="key"> <view class="list-view" v-for="(item, key) in infoKeys" :key="key">
...@@ -179,6 +180,7 @@ ...@@ -179,6 +180,7 @@
import NavbarRight from '@/components/navbar-right'; import NavbarRight from '@/components/navbar-right';
import PopImage from '@/components/pop-qrCode-image'; import PopImage from '@/components/pop-qrCode-image';
import QRCodeView from '@/components/qr-code-view'; import QRCodeView from '@/components/qr-code-view';
import ShowVoucher from './components/show-voucher.vue';
import { formatCount } from '@/utils/common.js'; import { formatCount } from '@/utils/common.js';
import { repairDetail, repairSign, repairSend } from '@/api/maintain/index.js'; import { repairDetail, repairSign, repairSend } from '@/api/maintain/index.js';
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
...@@ -186,12 +188,14 @@ import { maintain_share_url, wxMiniId, webUrl } from '@/utils/config.js'; ...@@ -186,12 +188,14 @@ import { maintain_share_url, wxMiniId, webUrl } from '@/utils/config.js';
import { getSetting } from '@/utils/common.js'; import { getSetting } from '@/utils/common.js';
import { checkToken } from '@/utils/common.js'; import { checkToken } from '@/utils/common.js';
import { tableOptions } from '@/utils/options/maintain-bill/index.js'; import { tableOptions } from '@/utils/options/maintain-bill/index.js';
import {getShopInfo} from "@/api/mine/shop.js"
export default { export default {
components: { components: {
NavbarRight, NavbarRight,
PopImage, PopImage,
QRCodeView QRCodeView,
ShowVoucher
}, },
data() { data() {
return { return {
...@@ -208,7 +212,10 @@ export default { ...@@ -208,7 +212,10 @@ export default {
poster: {}, poster: {},
currentBlock: () => {}, currentBlock: () => {},
billImageUrl: '', billImageUrl: '',
customerId: '' previewImageUrl:'',
customerId: '',
canvasType: 'save',
stopInfo:{},
}; };
}, },
computed: { computed: {
...@@ -386,6 +393,7 @@ export default { ...@@ -386,6 +393,7 @@ export default {
// this.billId = '1554382675614105600' // this.billId = '1554382675614105600'
if (checkToken()) { if (checkToken()) {
this.repairDetail(); this.repairDetail();
this.getShop()
} else { } else {
this.$u.route({ this.$u.route({
url: 'pages/login/login', url: 'pages/login/login',
...@@ -446,7 +454,15 @@ export default { ...@@ -446,7 +454,15 @@ export default {
this.loading = false; this.loading = false;
}); });
}, },
async getShop(){
try{
let res=await getShopInfo()
this.stopInfo=res.data
}catch(e){
//TODO handle the exception
console.log(e)
}
},
updateItem(id, state) { updateItem(id, state) {
for (var item of this.lists) { for (var item of this.lists) {
if (item.id == id) { if (item.id == id) {
...@@ -540,6 +556,7 @@ export default { ...@@ -540,6 +556,7 @@ export default {
}); });
}, },
handleClickSave() { handleClickSave() {
this.canvasType = 'save';
this.currentBlock = url => { this.currentBlock = url => {
uni.saveImageToPhotosAlbum({ uni.saveImageToPhotosAlbum({
filePath: url, filePath: url,
...@@ -606,527 +623,554 @@ export default { ...@@ -606,527 +623,554 @@ export default {
if (this.billImageUrl) { if (this.billImageUrl) {
this.currentBlock(this.billImageUrl); this.currentBlock(this.billImageUrl);
} else { } else {
var infoViews = []; if (this.info.type === 'voucher') {
for (var key in this.infoKeys) { this.saveVoucher();
infoViews.push({ } else {
css: { this.saveReceipt();
padding: '24rpx 0rpx 8rpx 0rpx', }
'font-size': '28rpx' }
},
saveReceipt() {
var infoViews = [];
for (var key in this.infoKeys) {
infoViews.push({
css: {
padding: '24rpx 0rpx 8rpx 0rpx',
'font-size': '28rpx'
},
views: [
{
css: {
color: '#8d8d8d',
width: '150rpx'
},
type: 'text',
text: this.infoKeys[key]
}, },
views: [ {
{ css: {
css: { 'font-weight': 'bold',
color: '#8d8d8d', color: '#333333',
width: '150rpx' textAlign: 'right',
}, 'line-clamp': 2,
type: 'text', boxSizing: 'border-box',
text: this.infoKeys[key] width: '508rpx'
}, },
{ type: 'text',
css: { text: this.info[key]
'font-weight': 'bold', }
color: '#333333', ]
textAlign: 'right', });
'line-clamp': 2, }
boxSizing: 'border-box', var tableView = [];
width: '508rpx' this.tableOptions.map((item, index) => {
}, let el = {
type: 'text', css: {
text: this.info[key] display: 'inline-block',
} width: '172rpx',
] textAlign: 'left',
}); color: '#8D8D8D',
fontSize: '28rpx'
},
type: 'text',
text: item.label
};
if (index === 1) {
el.css.width = '304rpx';
el.css.textAlign = 'center';
} else if (index === 2) {
el.css.textAlign = 'right';
} }
var tableView = []; tableView.push(el);
});
var tableValueViews = [];
this.info.expenseDetails.map(infoItem => {
var table = {
css: {
marginTop: '24rpx'
},
type: 'view',
views: []
};
this.tableOptions.map((item, index) => { this.tableOptions.map((item, index) => {
let el = { let el = {
css: { css: {
display: 'inline-block', display: 'inline-block',
width: '172rpx', width: '172rpx',
textAlign: 'left', textAlign: 'left',
color: '#8D8D8D', color: '#333333',
fontSize: '28rpx' fontSize: '28rpx'
}, },
type: 'text', type: 'text',
text: item.label text: infoItem[item.value]
}; };
if (index === 1) { if (index === 1) {
el.css.width = '304rpx'; el.css.width = '304rpx';
el.css.textAlign = 'center'; el.css.textAlign = 'center';
el.text = `${infoItem.unitPrice}${infoItem.unit ? '/' + infoItem.unit : ''}*${infoItem.number}`;
} else if (index === 2) { } else if (index === 2) {
el.css.textAlign = 'right'; el.css.textAlign = 'right';
} }
tableView.push(el); table.views.push(el);
}); });
tableValueViews.push(table);
});
var tableValueViews = []; var moneyViews = [];
this.info.expenseDetails.map(infoItem => { for (var item of this.moneyKeys) {
var table = { moneyViews.push({
css: { css: {
marginTop: '24rpx' padding: '24rpx 24rpx 8rpx 24rpx',
'font-size': '28rpx',
display: 'block'
},
views: [
{
css: {
color: '#8d8d8d',
width: '150rpx'
},
type: 'text',
text: item.title
}, },
type: 'view', {
views: []
};
this.tableOptions.map((item, index) => {
let el = {
css: { css: {
display: 'inline-block', 'font-weight': 'bold',
width: '172rpx', color: '#33333',
textAlign: 'left', textAlign: 'right',
color: '#333333', 'line-clamp': 2,
fontSize: '28rpx' boxSizing: 'border-box',
width: '508rpx',
color: item.color
}, },
type: 'text', type: 'text',
text: infoItem[item.value] text: item.text + this.info[item.key]
};
if (index === 1) {
el.css.width = '304rpx';
el.css.textAlign = 'center';
el.text = `${infoItem.unitPrice}${infoItem.unit ? '/' + infoItem.unit : ''}*${infoItem.number}`;
} else if (index === 2) {
el.css.textAlign = 'right';
} }
table.views.push(el); ]
});
tableValueViews.push(table);
}); });
if (item.line) {
var moneyViews = [];
for (var item of this.moneyKeys) {
moneyViews.push({ moneyViews.push({
type: 'image',
src: this.middlePartImage,
css: { css: {
padding: '24rpx 24rpx 8rpx 24rpx', width: '702rpx',
'font-size': '28rpx', height: '24rpx',
marginTop: '24rpx'
}
});
}
}
var otherView = {};
var middleView = {};
if (this.info.remark || (this.info.attach && this.info.attach.length > 0)) {
middleView = {
type: 'image',
src: this.middleImage,
css: {
width: '702rpx',
height: '24rpx'
}
};
var remarkView = {};
if (this.info.remark) {
remarkView = {
css: {
fontSize: '24rpx',
'font-weight': 'bold',
color: '#333333',
margin: '16rpx 0rpx 8rpx 0rpx',
display: 'block' display: 'block'
}, },
views: [ type: 'text',
{ text: this.info.remark
css: { };
color: '#8d8d8d', }
width: '150rpx' var imagesView = {};
}, if (this.info.attach && this.info.attach.length > 0) {
type: 'text', imagesView = {
text: item.title type: 'view',
}, css: {
{ background: '#ffffff',
css: { marginTop: '32rpx'
'font-weight': 'bold', },
color: '#33333', views: []
textAlign: 'right', };
'line-clamp': 2, var index = 0;
boxSizing: 'border-box', for (var item of this.info.attach) {
width: '508rpx', imagesView.views.push({
color: item.color
},
type: 'text',
text: item.text + this.info[item.key]
}
]
});
if (item.line) {
moneyViews.push({
type: 'image', type: 'image',
src: this.middlePartImage, src: item,
css: { css: {
width: '702rpx', marginRight: (index + 1) % 4 ? '26rpx' : '0rpx',
height: '24rpx', display: 'inline-block',
marginTop: '24rpx' height: '144rpx',
width: '144rpx',
borderRadius: '16rpx',
overflow: 'hidden',
marginBottom: '24rpx'
} }
}); });
index++;
} }
} }
otherView = {
var otherView = {}; type: 'view',
var middleView = {}; css: {
if (this.info.remark || (this.info.attach && this.info.attach.length > 0)) { padding: '16rpx 24rpx',
middleView = { background: '#ffffff'
type: 'image', },
src: this.middleImage, views: [
css: { {
width: '702rpx',
height: '24rpx'
}
};
var remarkView = {};
if (this.info.remark) {
remarkView = {
css: { css: {
fontSize: '24rpx', fontSize: '32rpx',
'font-weight': 'bold', 'font-weight': 'bold',
color: '#333333', color: '#333333',
margin: '16rpx 0rpx 8rpx 0rpx', margin: '8rpx 0rpx 8rpx 0rpx',
display: 'block' display: 'block'
}, },
type: 'text', type: 'text',
text: this.info.remark text: '本次服务记录'
}; },
} {
var imagesView = {};
if (this.info.attach && this.info.attach.length > 0) {
imagesView = {
type: 'view',
css: { css: {
background: '#ffffff', fontSize: '28rpx',
marginTop: '32rpx' color: '#8D8D8D',
margin: '16rpx 0rpx 8rpx 0rpx'
}, },
views: [] type: 'text',
}; text: '备注信息:'
var index = 0; },
for (var item of this.info.attach) { remarkView,
imagesView.views.push({ imagesView
type: 'image', ]
src: item, };
css: { }
marginRight: (index + 1) % 4 ? '26rpx' : '0rpx',
display: 'inline-block', var faultRecord = [];
height: '144rpx', if (this.info.faultRecord) {
width: '144rpx', faultRecord = [
borderRadius: '16rpx', {
overflow: 'hidden',
marginBottom: '24rpx'
}
});
index++;
}
}
otherView = {
type: 'view', type: 'view',
css: { css: {
padding: '16rpx 24rpx', background: '#ffffff',
background: '#ffffff' paddingBottom: '24rpx'
}, },
views: [ views: [
{ {
css: { css: {
fontSize: '32rpx', padding: '24rpx 24rpx 8rpx 24rpx',
'font-weight': 'bold', 'font-size': '28rpx'
color: '#333333',
margin: '8rpx 0rpx 8rpx 0rpx',
display: 'block'
}, },
type: 'text', views: [
text: '本次服务记录' {
css: {
color: '#8d8d8d'
},
type: 'text',
text: '品牌:'
},
{
css: {
'font-weight': 'bold',
color: '#33333',
textAlign: 'right',
width: '564rpx',
color: item.color
},
type: 'text',
text: this.info.faultRecord.category
}
]
}, },
{ {
css: { css: {
fontSize: '28rpx', padding: '24rpx 24rpxrpx 8rpx 24rpx',
color: '#8D8D8D', 'font-size': '28rpx',
margin: '16rpx 0rpx 8rpx 0rpx' background: 'red'
}, },
type: 'text', views: [
text: '备注信息:' {
}, css: {
remarkView, color: '#8d8d8d'
imagesView
]
};
}
var faultRecord = [];
if (this.info.faultRecord) {
faultRecord = [
{
type: 'view',
css: {
background: '#ffffff',
paddingBottom: '24rpx'
},
views: [
{
css: {
padding: '24rpx 24rpx 8rpx 24rpx',
'font-size': '28rpx'
},
views: [
{
css: {
color: '#8d8d8d'
},
type: 'text',
text: '品牌:'
}, },
{ type: 'text',
css: { text: '型号:'
'font-weight': 'bold',
color: '#33333',
textAlign: 'right',
width: '564rpx',
color: item.color
},
type: 'text',
text: this.info.faultRecord.category
}
]
},
{
css: {
padding: '24rpx 24rpxrpx 8rpx 24rpx',
'font-size': '28rpx',
background: 'red'
}, },
views: [ {
{ css: {
css: { 'font-weight': 'bold',
color: '#8d8d8d' color: '#33333',
}, textAlign: 'right',
type: 'text', width: '564rpx',
text: '型号:' color: '#333333'
}, },
{ type: 'text',
css: { text: this.info.faultRecord.machineModel
'font-weight': 'bold',
color: '#33333',
textAlign: 'right',
width: '564rpx',
color: '#333333'
},
type: 'text',
text: this.info.faultRecord.machineModel
}
]
},
{
type: 'image',
src: this.middleImage,
css: {
width: '702rpx',
height: '24rpx',
marginTop: '24rpx'
} }
]
},
{
type: 'image',
src: this.middleImage,
css: {
width: '702rpx',
height: '24rpx',
marginTop: '24rpx'
}
},
{
css: {
padding: '24rpx 24rpx 8rpx 24rpx',
'font-size': '28rpx'
}, },
{ views: [
css: { {
padding: '24rpx 24rpx 8rpx 24rpx', type: 'view',
'font-size': '28rpx' css: {
}, marginBottom: '24rpx'
views: [
{
type: 'view',
css: {
marginBottom: '24rpx'
},
views: [
{
css: {
color: '#8d8d8d'
},
type: 'text',
text: '故障现象:'
}
]
}, },
{ views: [
type: 'view', {
views: [ css: {
{ color: '#8d8d8d'
css: { },
'font-weight': 'bold', type: 'text',
color: '#333333', text: '故障现象:'
width: '654rpx' }
}, ]
type: 'text',
text: this.info.faultRecord.symptom
}
]
}
]
},
{
css: {
padding: '24rpx 24rpx 8rpx 24rpx',
'font-size': '28rpx'
}, },
views: [ {
{ type: 'view',
type: 'view', views: [
css: { {
marginBottom: '24rpx' css: {
}, 'font-weight': 'bold',
views: [ color: '#333333',
{ width: '654rpx'
css: { },
color: '#8d8d8d' type: 'text',
}, text: this.info.faultRecord.symptom
type: 'text', }
text: '检修结果:' ]
} }
] ]
},
{
css: {
padding: '24rpx 24rpx 8rpx 24rpx',
'font-size': '28rpx'
},
views: [
{
type: 'view',
css: {
marginBottom: '24rpx'
}, },
{ views: [
type: 'view', {
views: [ css: {
{ color: '#8d8d8d'
css: { },
'font-weight': 'bold', type: 'text',
color: '#333333', text: '检修结果:'
width: '654rpx' }
}, ]
type: 'text', },
text: this.info.faultRecord.repairResult {
} type: 'view',
] views: [
} {
] css: {
} 'font-weight': 'bold',
] color: '#333333',
}, width: '654rpx'
{ },
type: 'image', type: 'text',
src: this.middleEndImage, text: this.info.faultRecord.repairResult
css: { }
width: '702rpx', ]
height: '24rpx' }
]
} }
]
},
{
type: 'image',
src: this.middleEndImage,
css: {
width: '702rpx',
height: '24rpx'
} }
]; }
} ];
}
this.poster = { this.poster = {
css: { css: {
width: '750rpx', width: '750rpx',
'background-color': '#EFEFEF' 'background-color': '#EFEFEF'
},
views: [
{
type: 'view',
css: {
width: '100%',
background: 'linear-gradient(,#EFEFEF 0%, #02a074 50%, #02a074 100%)',
height: '440rpx'
}
}, },
views: [ {
{ type: 'view',
type: 'view', css: {
css: { position: 'absolute',
width: '100%', top: '80rpx',
background: 'linear-gradient(,#EFEFEF 0%, #02a074 50%, #02a074 100%)', left: this.isSure ? '218rpx' : '238rpx',
height: '440rpx' display: 'flex',
} 'align-items': 'center',
'justify-content': 'center'
}, },
{ views: [
type: 'view', {
css: { type: 'image',
position: 'absolute', src: this.titleInfo.image,
top: '80rpx', css: {
left: this.isSure ? '218rpx' : '238rpx', width: '48rpx',
display: 'flex', height: '48rpx',
'align-items': 'center', 'margin-right': '24rpx',
'justify-content': 'center' display: 'inline-block'
}
}, },
views: [ {
{ type: 'text',
type: 'image', text: this.titleInfo.text,
src: this.titleInfo.image, css: {
css: { 'font-weight': 'bold',
width: '48rpx', fontSize: '40rpx',
height: '48rpx', color: '#ffffff',
'margin-right': '24rpx', display: 'inline-block'
display: 'inline-block'
}
},
{
type: 'text',
text: this.titleInfo.text,
css: {
'font-weight': 'bold',
fontSize: '40rpx',
color: '#ffffff',
display: 'inline-block'
}
} }
]
},
{
type: 'view',
css: {
marginTop: '-266rpx',
marginLeft: '18rpx',
marginRight: '18rpx',
background: 'linear-gradient(, #94d4c4 0%, #2fbd96 50%, #7ed9c5 100%)',
height: '20rpx',
'border-radius': '10rpx'
} }
]
},
{
type: 'view',
css: {
marginTop: '-266rpx',
marginLeft: '18rpx',
marginRight: '18rpx',
background: 'linear-gradient(, #94d4c4 0%, #2fbd96 50%, #7ed9c5 100%)',
height: '20rpx',
'border-radius': '10rpx'
}
},
{
type: 'view',
css: {
left: '24rpx',
right: '24rpx',
marginTop: '-254rpx',
marginLeft: '24rpx',
marginRight: '24rpx',
marginBottom: '44rpx'
}, },
{ views: [
type: 'view', {
css: { type: 'view',
left: '24rpx', css: {
right: '24rpx', background: '#ffffff',
marginTop: '-254rpx', padding: '16rpx 24rpx'
marginLeft: '24rpx',
marginRight: '24rpx',
marginBottom: '44rpx'
},
views: [
{
type: 'view',
css: {
background: '#ffffff',
padding: '16rpx 24rpx'
},
views: [
{
css: {
fontSize: '32rpx',
'font-weight': 'bold',
color: '#333333',
margin: '16rpx 0rpx 8rpx 0rpx',
display: 'block'
},
type: 'text',
text: '账单信息'
},
...infoViews
]
},
{
type: 'image',
src: this.middleImage,
css: {
width: '702rpx',
height: '24rpx'
}
}, },
{ views: [
type: 'view', {
css: { css: {
padding: '24rpx', fontSize: '32rpx',
background: '#ffffff' 'font-weight': 'bold',
}, color: '#333333',
views: [ margin: '16rpx 0rpx 8rpx 0rpx',
{ display: 'block'
type: 'view',
css: {},
views: tableView
}, },
...tableValueViews type: 'text',
] text: '账单信息'
},
{
type: 'image',
src: this.middlePartImage,
css: {
width: '702rpx',
height: '24rpx'
}
},
{
type: 'view',
css: {
background: '#ffffff',
paddingBottom: '24rpx'
}, },
views: moneyViews ...infoViews
]
},
{
type: 'image',
src: this.middleImage,
css: {
width: '702rpx',
height: '24rpx'
}
},
{
type: 'view',
css: {
padding: '24rpx',
background: '#ffffff'
}, },
middleView, views: [
otherView, {
{ type: 'view',
type: 'image', css: {},
src: this.info.faultRecord ? this.middlePartImage : this.middleEndImage, views: tableView
css: { },
width: '702rpx', ...tableValueViews
height: '24rpx' ]
} },
{
type: 'image',
src: this.middlePartImage,
css: {
width: '702rpx',
height: '24rpx'
}
},
{
type: 'view',
css: {
background: '#ffffff',
paddingBottom: '24rpx'
}, },
...faultRecord views: moneyViews
] },
} middleView,
] otherView,
}; {
type: 'image',
src: this.info.faultRecord ? this.middlePartImage : this.middleEndImage,
css: {
width: '702rpx',
height: '24rpx'
}
},
...faultRecord
]
}
]
};
},
saveVoucher() {
this.$refs['show-voucher'].handleSaveVoucher();
uni.hideLoading();
},
savePoster(poster) {
if(this.billImageUrl){
this.saveBillImage()
}else{
this.poster = poster;
}
},
previewPoster(poster) {
this.canvasType = 'preview';
if(this.previewImageUrl){
this.previewVoucher()
}else{
this.poster = poster;
} }
}, },
handleClickScan() { handleClickScan() {
this.visible = true; this.visible = true;
...@@ -1146,11 +1190,30 @@ export default { ...@@ -1146,11 +1190,30 @@ export default {
handleCanvas(url) { handleCanvas(url) {
this.path = url; this.path = url;
}, },
handleCanvasSuccess(url) { handleCanvasSuccess(url) {
console.log('---------handleCanvasSuccess--------', url); console.log('---------handleCanvasSuccess--------', url);
this.billImageUrl = url; if (this.canvasType === 'save') {
this.currentBlock(url); this.billImageUrl = url;
this.currentBlock(url);
} else {
this.previewImageUrl = url;
this.previewVoucher()
}
},
previewVoucher(){
uni.previewImage({
urls: [this.previewImageUrl],
current: 0,
longPressActions: {
itemList: ['发送给朋友', '保存图片', '收藏'],
success: function(data) {
console.log('选中了第' + (data.tapIndex + 1) + '个按钮,第' + (data.index + 1) + '张图片');
},
fail: function(err) {
console.log(err.errMsg);
}
}
});
}, },
formatCount(count) { formatCount(count) {
return formatCount(count); return formatCount(count);
......
...@@ -16,9 +16,10 @@ ...@@ -16,9 +16,10 @@
@input="handleInput" @input="handleInput"
/> />
<view v-if="!disabled" class="tip-view">{{ tipText }}</view> <view v-if="!disabled" class="tip-view">{{ tipText }}</view>
</view> <view class="bottom-view">
<view class="bottom-view"> <u-button :customStyle="buttonStyle" @click="handleClick"><view class="button-text">确定</view></u-button>
<u-button :customStyle="buttonStyle" @click="handleClick"><view class="button-text">确定</view></u-button> <u-button :customStyle="deleteStyle" @click="handleDelete" v-if="id"><view class="button-text delete-button">删除</view></u-button>
</view>
</view> </view>
</view> </view>
</template> </template>
...@@ -33,7 +34,23 @@ export default { ...@@ -33,7 +34,23 @@ export default {
return { return {
value: '', value: '',
type: '', type: '',
disabled: false deleteType: '',
disabled: false,
deleteStyle: {
marginTop: '24rpx',
'background-color': '#FFFFFF',
height: '104rpx',
'border-radius': '16rpx'
},
id: null,
whiteSpace: false,
inputStyle: {
'border-radius': '8rpx',
'background-color': '#F6F7FA',
padding: '24rpx',
'font-size': '28rpx',
color: '#333333'
}
}; };
}, },
computed: { computed: {
...@@ -49,17 +66,9 @@ export default { ...@@ -49,17 +66,9 @@ export default {
}; };
}, },
placeholderStyle() { placeholderStyle() {
return 'color: #cccccc;font-size: 28rpx;font-weight: bold;' return 'color: #cccccc;font-size: 28rpx;font-weight: bold;';
},
inputStyle() {
return {
'border-radius': '8rpx',
'background-color': '#F6F7FA',
padding: '24rpx',
'font-size': '28rpx',
color: '#333333'
};
}, },
tipText() { tipText() {
return `${this.value.length || 0}/${this.info.maxlength}`; return `${this.value.length || 0}/${this.info.maxlength}`;
}, },
...@@ -90,6 +99,14 @@ export default { ...@@ -90,6 +99,14 @@ export default {
maxlength: 20, maxlength: 20,
height: 240 height: 240
}; };
case 'lister':
return {
title: '制表人',
type: 'textarea',
placeholder: '请输入制表人',
maxlength: 20,
height: 240
};
case 'payments-setting': case 'payments-setting':
return { return {
title: '类型名称', title: '类型名称',
...@@ -106,12 +123,12 @@ export default { ...@@ -106,12 +123,12 @@ export default {
maxlength: 10, maxlength: 10,
height: 240 height: 240
}; };
case 'menu-introduce': case 'create-remark':
return { return {
title: '频道介绍', title: '备注模板',
type: 'textarea', type: 'textarea',
placeholder: '请输入频道介绍(200个字以内)', placeholder: '请输入备注模板(200个字以内)',
maxlength: 200, maxlength: 100,
height: 240 height: 240
}; };
case 'camp-introduce': case 'camp-introduce':
...@@ -153,12 +170,22 @@ export default { ...@@ -153,12 +170,22 @@ export default {
if (options && options.type) { if (options && options.type) {
this.type = options.type; this.type = options.type;
} }
if (options && options.deleteType) {
this.deleteType = options.deleteType;
}
if (options && options.value && options.value != 'null') { if (options && options.value && options.value != 'null') {
this.value = decodeURIComponent(decodeURIComponent(options.value)); this.value = decodeURIComponent(decodeURIComponent(options.value));
} }
if (options && options.disabled) { if (options && options.disabled) {
this.disabled = options.disabled; this.disabled = options.disabled;
} }
if (options && options.id) {
this.id = options.id;
}
if (options && options.whiteSpace) {
this.whiteSpace = options.whiteSpace;
this.inputStyle.whiteSpace='pre-wrap'
}
}, },
onUnload() { onUnload() {
let notification = `input-sure-${this.type}`; let notification = `input-sure-${this.type}`;
...@@ -175,17 +202,27 @@ export default { ...@@ -175,17 +202,27 @@ export default {
}, },
handleClick() { handleClick() {
if (!this.disabled) { if (!this.disabled) {
if(!this.value.trim()){ if (!this.value.trim()) {
this.$u.toast("内容不能为空") this.$u.toast('内容不能为空');
return false return false;
} }
let notification = `input-sure-${this.type}`; let notification = `input-sure-${this.type}`;
let str= this.value.replace(/[\r\n]/g,"") let str = this.value.replace(/[\r\n]/g, '');
uni.$emit(notification, { uni.$emit(notification, {
content: str content: str
}); });
} }
this.$u.route({
type: 'back'
});
},
handleDelete() {
if (this.id) {
uni.$emit(this.deleteType, {
id: this.id
});
}
this.$u.route({ this.$u.route({
type: 'back' type: 'back'
}); });
...@@ -214,7 +251,7 @@ export default { ...@@ -214,7 +251,7 @@ export default {
} }
.bottom-view { .bottom-view {
margin: 24rpx 32rpx 44rpx 32rpx; margin: 24rpx 0;
height: 104rpx; height: 104rpx;
.button-text { .button-text {
...@@ -224,6 +261,10 @@ export default { ...@@ -224,6 +261,10 @@ export default {
font-weight: bold; font-weight: bold;
font-size: 32rpx; font-size: 32rpx;
} }
.delete-button {
text-align: center;
color: #fc524d;
}
} }
} }
</style> </style>
<template>
<!-- 拖动 -->
<view class="edit-box" :style="{ top: 0 }">
<view class="zhuti">
<scroll-view :scroll-y="pageInfo.scrollY" class="product-section">
<view class="list">
<uni-swipe-action ref="swipeAction" >
<view class="swipe-action-outside" v-for="(item, index) in optionLists" :key="item.id">
<uni-swipe-action-item
:right-options="options"
bg-color="#f6f7fa"
:index="item.id"
:auto-close="true"
@click.stop="onClick($event, item, index)"
@change="swipeChange($event, index)"
>
<view
class="row list-row"
:data-index="index"
@longpress.stop="longpress($event, item, index)"
@touchmove="dragMove"
@touchend="dragEnd($event, item)"
:class="{ 'ready-place': pageInfo.readyPlaceIndex === index }"
:id="`item-view-${item.id}`"
:style="'height: ' + pageInfo.rowHeight + 'px;'"
@click.stop="closeAll"
>
<view class="item-view" @click.stop="clickCell(item, index)">
<view class="left-view">
<view class="image-view"><image :src="billBaseUrl + item.icon" v-if="item.icon"></image></view>
<view class="name-view">{{ item.label }}</view>
</view>
</view>
</view>
</uni-swipe-action-item>
</view>
</uni-swipe-action>
</view>
</scroll-view>
<movable-area class="movable-area" :class="{ 'movable-area-active': pageInfo.beginMove }">
<movable-view
class="row list-row movable-row"
:class="{ 'movable-row-active': pageInfo.beginMove }"
:out-of-bounds="true"
damping="999"
direction="vertical"
:y="movableViewInfo.y"
>
<view class="item-view">
<view class="left-view">
<view class="image-view"><image :src="billBaseUrl + 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 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 { billBaseUrl } from '@/utils/config.js';
import { mapGetters } from 'vuex';
export default {
name: 'dragEdit',
props: ['list'],
components: {
UniSwipeAction,
UniSwipeActionItem,
PopInput
},
data() {
return {
billBaseUrl,
showConfirm: false,
readyDeleteItem: 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
},
beginMove: false,
top: 0,
systemInfo: {}
};
},
watch: {
list: {
handler(val) {
this.optionLists = [...val];
},
immediate: true,
deep: true
}
},
computed: {
...mapGetters(['platform']),
movableViewStyle() {
let style = `height: ${this.pageInfo.rowHeight}px`;
return style;
}
},
mounted() {
this.systemInfo = uni.getSystemInfoSync();
this.optionLists = [...this.list];
},
methods: {
resize(){
if (this.platform === '4') {
this.$nextTick(() => {
if(this.$refs.swipeAction){
// this.$refs["swipeAction"].resize()
}
});
}
},
beginMoveChange() {
this.beginMove = !this.beginMove;
this.pageInfo.beginMove = !this.pageInfo.beginMove;
},
clickCell(item) {
let flag = true;
this.optionLists.map(el => {
if (el.show) {
flag = false;
}
});
if (flag) {
this.toEdit(item);
}
},
onClick(e, item) {
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);
}
}
},
swipeChange(e, index) {
console.log('当前状态:' + e + ',下标:' + index);
this.list[index].show = e === 'right' ? true : false;
},
toEdit(item) {
let value = item.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.map(el => {
if (el.id === item.id) {
el.label = res.content;
}
});
this.$emit('onEdit', item);
});
},
handleConfirm() {
// this.optionLists.map(item => {
// if (item.id === this.readyDeleteItem.id) {
// item.show = false;
// }
// });
this.$emit('onDelete', this.readyDeleteItem);
},
handleCancel() {
// this.optionLists.map(item => {
// if (item.id === this.readyDeleteItem.id) {
// item.show = false;
// }
// });
},
beforeDelete(item) {
this.readyDeleteItem = item;
this.showConfirm = true;
},
// 通知父组件修改排序
onChange() {
this.$emit('onChange', this.optionLists);
},
handleClickMember(row) {
this.$emit('handleClickMember', row);
},
closeAll() {
if (this.optionLists.length) {
// this.optionLists.map(item => {
// item.show = false;
// });
}
},
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 - 各种参数
console.log('boundingClientRect', data);
this.top = data.top;
this.dragStart(event, item);
}).exec();
},
// 拖拽开始(按下)
dragStart(event, item) {
console.log('dragStart');
// 开始本次拖拽
this.pageInfo.beginMove = true;
// this.$set(this.pageInfo,'beginMove',true)
// 本次移动的view真实下标
var currentMoveIndex = (this.optionLists || []).findIndex(x => x.id === item.id);
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%;
height: 100%;
position: absolute;
top: 0;
bottom: 0;
left: 0;
overflow: scroll;
}
.row {
height: 66px;
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%;
visibility: hidden;
height: 0;
}
.movable-area-active {
visibility: unset;
display: inline-block;
height: 100%;
// display: block;
}
.movable-row {
// visibility: hidden;
height: 0;
.item-view {
}
}
.movable-row-active {
box-shadow: #d9d9d9 0 0 20px;
// visibility: unset;
height: 66px;
}
.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%;
height: 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>
...@@ -4,16 +4,16 @@ ...@@ -4,16 +4,16 @@
<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"> <view class="list">
<uni-swipe-action ref="swipeAction" > <!-- <uni-swipe-action ref="swipeAction" > -->
<view class="swipe-action-outside" v-for="(item, index) in optionLists" :key="item.id"> <view class="swipe-action-outside" v-for="(item, index) in optionLists" :key="item.id">
<uni-swipe-action-item <!-- <uni-swipe-action-item
:right-options="options" :right-options="options"
bg-color="#f6f7fa" bg-color="#f6f7fa"
:index="item.id" :index="item.id"
:auto-close="true" :auto-close="true"
@click.stop="onClick($event, item, index)" @click.stop="onClick($event, item, index)"
@change="swipeChange($event, index)" @change="swipeChange($event, index)"
> > -->
<view <view
class="row list-row" class="row list-row"
:data-index="index" :data-index="index"
...@@ -30,11 +30,14 @@ ...@@ -30,11 +30,14 @@
<view class="image-view"><image :src="billBaseUrl + item.icon" v-if="item.icon"></image></view> <view class="image-view"><image :src="billBaseUrl + 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 class="right-view">
<u-icon name="edit-pen"></u-icon>
</view> -->
</view> </view>
</view> </view>
</uni-swipe-action-item> <!-- </uni-swipe-action-item> -->
</view> </view>
</uni-swipe-action> <!-- </uni-swipe-action> -->
</view> </view>
</scroll-view> </scroll-view>
<movable-area class="movable-area" :class="{ 'movable-area-active': pageInfo.beginMove }"> <movable-area class="movable-area" :class="{ 'movable-area-active': pageInfo.beginMove }">
...@@ -101,7 +104,7 @@ export default { ...@@ -101,7 +104,7 @@ export default {
optionLists: [], optionLists: [],
pageInfo: { pageInfo: {
scrollY: true, // 当为true时拖动单条,整个大盒子不会滚动 scrollY: true, // 当为true时拖动单条,整个大盒子不会滚动
rowHeight: 66, // 单条行高 rowHeight: 44, // 单条行高
scrollHeight: 100, // 拖动时行高,百分比 scrollHeight: 100, // 拖动时行高,百分比
startIndex: null, // 当前拖动第几条 startIndex: null, // 当前拖动第几条
startY: 0, // 定位拖动时的位置,需要减去上方空白部分 startY: 0, // 定位拖动时的位置,需要减去上方空白部分
...@@ -111,7 +114,9 @@ export default { ...@@ -111,7 +114,9 @@ export default {
}, },
beginMove: false, beginMove: false,
top: 0, top: 0,
systemInfo: {} systemInfo: {},
editType:'payments-setting',
deleteType:'payments-setting-delete',
}; };
}, },
watch: { watch: {
...@@ -135,6 +140,10 @@ export default { ...@@ -135,6 +140,10 @@ export default {
this.systemInfo = uni.getSystemInfoSync(); this.systemInfo = uni.getSystemInfoSync();
this.optionLists = [...this.list]; this.optionLists = [...this.list];
}, },
beforeDestroy(){
uni.$off(`input-sure-${this.editType}`);
uni.$off(this.deleteType);
},
methods: { methods: {
resize(){ resize(){
if (this.platform === '4') { if (this.platform === '4') {
...@@ -151,11 +160,11 @@ export default { ...@@ -151,11 +160,11 @@ export default {
}, },
clickCell(item) { clickCell(item) {
let flag = true; let flag = true;
this.optionLists.map(el => { // this.optionLists.map(el => {
if (el.show) { // if (el.show) {
flag = false; // flag = false;
} // }
}); // });
if (flag) { if (flag) {
this.toEdit(item); this.toEdit(item);
} }
...@@ -181,11 +190,13 @@ export default { ...@@ -181,11 +190,13 @@ export default {
this.$u.route({ this.$u.route({
url: '/pages/mine/input/input', url: '/pages/mine/input/input',
params: { params: {
type: 'payments-setting', type: this.editType,
value: encodeURIComponent(value) deleteType:this.deleteType,
value: encodeURIComponent(value),
id:item.id
} }
}); });
uni.$once(`input-sure-payments-setting`, res => { uni.$once(`input-sure-${this.editType}`, res => {
this.optionLists.map(el => { this.optionLists.map(el => {
if (el.id === item.id) { if (el.id === item.id) {
el.label = res.content; el.label = res.content;
...@@ -193,6 +204,13 @@ export default { ...@@ -193,6 +204,13 @@ export default {
}); });
this.$emit('onEdit', item); this.$emit('onEdit', item);
}); });
uni.$once(this.deleteType, res => {
this.optionLists.map(el => {
if (el.id === item.id) {
this.beforeDelete(el);
}
});
});
}, },
handleConfirm() { handleConfirm() {
// this.optionLists.map(item => { // this.optionLists.map(item => {
...@@ -390,7 +408,7 @@ export default { ...@@ -390,7 +408,7 @@ export default {
overflow: scroll; overflow: scroll;
} }
.row { .row {
height: 66px; height: 44px;
width: 100%; width: 100%;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
...@@ -434,7 +452,7 @@ export default { ...@@ -434,7 +452,7 @@ export default {
.movable-row-active { .movable-row-active {
box-shadow: #d9d9d9 0 0 20px; box-shadow: #d9d9d9 0 0 20px;
// visibility: unset; // visibility: unset;
height: 66px; height: 44px;
} }
.ready-place { .ready-place {
...@@ -456,8 +474,8 @@ export default { ...@@ -456,8 +474,8 @@ export default {
width: 100%; width: 100%;
height: 100%; height: 100%;
.image-view { .image-view {
width: 72rpx; width: 48rpx;
height: 72rpx; height: 48rpx;
margin-right: 40rpx; margin-right: 40rpx;
} }
...@@ -472,6 +490,9 @@ export default { ...@@ -472,6 +490,9 @@ export default {
height: 100%; height: 100%;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center;
width: 80rpx;
font-size: 36rpx;
} }
} }
</style> </style>
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<view class="content-view"> <view class="content-view">
<view class="content-view-tips"> <view class="content-view-tips">
<view class="content-view-tips-icon"><image :src="tipsUrl" mode="" class="content-view-tips-icon-image"></image></view> <view class="content-view-tips-icon"><image :src="tipsUrl" mode="" class="content-view-tips-icon-image"></image></view>
<view class="content-view-tips-content"><view>操作提示:1、长按可移动排序;2、左滑可编辑删除。</view></view> <view class="content-view-tips-content"><view>操作提示:1、长按可移动排序;2、点击可编辑删除。</view></view>
</view> </view>
<view class="button-view"> <view class="button-view">
<view class="button-view-item" :class="{ 'button-view-active': form.type === item.value }" v-for="(item, index) in buttons" :key="index" @click="tabChange(item)"> <view class="button-view-item" :class="{ 'button-view-active': form.type === item.value }" v-for="(item, index) in buttons" :key="index" @click="tabChange(item)">
......
...@@ -72,7 +72,8 @@ ...@@ -72,7 +72,8 @@
</view> </view>
</u-popup> </u-popup>
<!-- :disabled="disabled" --> <!-- :disabled="disabled" -->
<view class="submit" v-loading="loading"><ab-button :customStyle="customStyle" @click="submit"></ab-button></view> <view class="submit" v-loading="loading"><ab-button :customStyle="customStyleButton" @click="submit"></ab-button></view>
<view class="submit" v-if="form.id"><ab-button content="删除" :customStyle="deleteButton" @click="handleDelete"></ab-button></view>
<u-picker confirm-color="#02A074" v-model="timeShow" mode="time" :default-time="defaultTime" :params="timeParams" @confirm="timePickerConfirm"></u-picker> <u-picker confirm-color="#02A074" v-model="timeShow" mode="time" :default-time="defaultTime" :params="timeParams" @confirm="timePickerConfirm"></u-picker>
</view> </view>
</template> </template>
...@@ -91,7 +92,7 @@ export default { ...@@ -91,7 +92,7 @@ export default {
components: { CheckboxGroups, AbButton, WeekCheckboxGroups }, components: { CheckboxGroups, AbButton, WeekCheckboxGroups },
data() { data() {
return { return {
customStyle: { customStyleButton: {
fontSize: '32rpx' fontSize: '32rpx'
}, },
checkboxCustomStyle: { checkboxCustomStyle: {
...@@ -103,6 +104,13 @@ export default { ...@@ -103,6 +104,13 @@ export default {
textAlign: 'right', textAlign: 'right',
fontWeight: 'bold' fontWeight: 'bold'
}, },
deleteButton:{
marginTop:'24rpx',
fontSize: '32rpx',
color: '#fc524d',
background:'#FFFFFF',
border: "2rpx solid #7dcfb8",
},
checkboxCustomStyle1: { checkboxCustomStyle1: {
width: '156rpx', width: '156rpx',
height: '78rpx' height: '78rpx'
...@@ -298,6 +306,16 @@ export default { ...@@ -298,6 +306,16 @@ export default {
} }
this.loading = false; this.loading = false;
}, },
handleDelete() {
if (this.form.id) {
uni.$emit('timed-sure-delete', {
id: this.form.id
});
}
this.$u.route({
type: 'back'
});
},
navigateTo() { navigateTo() {
this.$u.route({ this.$u.route({
type: 'back' type: 'back'
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
<view class="list"> <view class="list">
<NoData v-if="noData" :text="noDataText" customStyle="margin-top: 0rpx;" :imageName="noDataImage" /> <NoData v-if="noData" :text="noDataText" customStyle="margin-top: 0rpx;" :imageName="noDataImage" />
<block v-else> <block v-else>
<uni-swipe-action> <!-- <uni-swipe-action> -->
<view class="swipe-action-outside" v-for="(item, index) in list" :key="item.id"> <view class="swipe-action-outside" v-for="(item, index) in list" :key="item.id">
<uni-swipe-action-item :right-options="options" @click="onClick($event,item)" @change="swipeChange($event, index)"> <!-- <uni-swipe-action-item :right-options="options" @click="onClick($event,item)" @change="swipeChange($event, index)"> -->
<view class="list-row" @click.stop="clickCell(item)"> <view class="list-row" @click.stop="clickCell(item)">
<view class="list-row-view list-row-left"> <view class="list-row-view list-row-left">
<view class="list-row-view-top"> <view class="list-row-view-top">
...@@ -40,9 +40,9 @@ ...@@ -40,9 +40,9 @@
</view> </view>
</view> </view>
</view> </view>
</uni-swipe-action-item> <!-- </uni-swipe-action-item> -->
</view> </view>
</uni-swipe-action> <!-- </uni-swipe-action> -->
</block> </block>
<PopInput title="删除提醒" type="text" sureText="确定" content="确认删除该定时计划?" :visible.sync="showConfirm" @click="handleConfirm" @cancel="handleCancel" /> <PopInput title="删除提醒" type="text" sureText="确定" content="确认删除该定时计划?" :visible.sync="showConfirm" @click="handleConfirm" @cancel="handleCancel" />
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
<script> <script>
import UniSwipeAction from '@/components/uni-swipe-action/uni-swipe-action.vue'; 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 UniSwipeActionItem from '@/components/uni-swipe-action-item/uni-swipe-action-item.vue';
import NoData from '@/components/no-data';
import PopInput from '@/components/pop-input-view'; import PopInput from '@/components/pop-input-view';
import SubmitButton from '@/components/submit-button/index.vue'; import SubmitButton from '@/components/submit-button/index.vue';
import { billBaseUrl } from '@/utils/config.js'; import { billBaseUrl } from '@/utils/config.js';
...@@ -63,6 +63,7 @@ export default { ...@@ -63,6 +63,7 @@ export default {
components: { components: {
UniSwipeAction, UniSwipeAction,
UniSwipeActionItem, UniSwipeActionItem,
NoData,
PopInput, PopInput,
SubmitButton SubmitButton
}, },
...@@ -100,6 +101,9 @@ export default { ...@@ -100,6 +101,9 @@ export default {
return (this.list || []).length == 0 && this.loaded; return (this.list || []).length == 0 && this.loaded;
} }
}, },
onUnload() {
uni.$off("timed-sure-delete");
},
methods: { methods: {
onClick(e,item) { onClick(e,item) {
console.log(e); console.log(e);
...@@ -150,6 +154,16 @@ export default { ...@@ -150,6 +154,16 @@ export default {
uni.$once(`refreshList`, res => { uni.$once(`refreshList`, res => {
this.getList(); this.getList();
}); });
if(id){
uni.$once(`timed-sure-delete`, res => {
this.list.map(el => {
if (el.id === res.id) {
this.beforeDelete(el);
}
});
});
}
}, },
clickCell(item) { clickCell(item) {
let flag = true; let flag = true;
......
...@@ -73,6 +73,11 @@ const router = createRouter({ ...@@ -73,6 +73,11 @@ const router = createRouter({
runtimeQuit(); runtimeQuit();
} }
// #endif // #endif
if(type===2){
setTimeout(()=>{
router.$lockStatus=false;
},6000)
}
}, },
routes: [ routes: [
...ROUTES, ...ROUTES,
......
...@@ -119,6 +119,13 @@ export function getEyeFill() { ...@@ -119,6 +119,13 @@ export function getEyeFill() {
export function removeEyeFill() { export function removeEyeFill() {
uni.removeStorageSync("EYEFILL"); uni.removeStorageSync("EYEFILL");
} }
export function setMaintainBillType(data) {
uni.setStorageSync("MAINTAIN-BILL", data);
}
export function getMaintainBillType() {
return uni.getStorageSync("MAINTAIN-BILL") || ""
}
export function checkLoginAndVip(callback) { export function checkLoginAndVip(callback) {
if (checkToken()) { if (checkToken()) {
...@@ -141,7 +148,7 @@ export function checkLoginAndVip(callback) { ...@@ -141,7 +148,7 @@ export function checkLoginAndVip(callback) {
success() { success() {
setTimeout(() => { setTimeout(() => {
uni.navigateTo({ uni.navigateTo({
animationType:'pop-in', animationType: 'pop-in',
url: '/pages/login/login' url: '/pages/login/login'
}) })
}, 1500) }, 1500)
...@@ -225,8 +232,8 @@ export function checkCodeTimetamp() { ...@@ -225,8 +232,8 @@ export function checkCodeTimetamp() {
} }
// 查询权限 // 查询权限
export function getSetting(scope, text, block, errBlock = () => {}) { export function getSetting(scope, text, block, errBlock = () => {}) {
// #ifdef APP-PLUS // #ifdef APP-PLUS
if (uni.getSystemInfoSync().platform === "ios") { if (uni.getSystemInfoSync().platform === "ios") {
var result = permision.judgeIosPermission(scope) var result = permision.judgeIosPermission(scope)
if (result) { if (result) {
block() block()
...@@ -245,16 +252,16 @@ export function getSetting(scope, text, block, errBlock = () => {}) { ...@@ -245,16 +252,16 @@ export function getSetting(scope, text, block, errBlock = () => {}) {
}, },
}) })
} }
} else { } else {
permision.requestAndroidPermission(scope).then(result=>{ permision.requestAndroidPermission(scope).then(result => {
console.log("result",result) console.log("result", result)
// result == 1 "已获得授权" // result == 1 "已获得授权"
// result == 0 "未获得授权" // result == 0 "未获得授权"
if (result == 1) { if (result == 1) {
block() block()
}else if(result == 0) { } else if (result == 0) {
errBlock(result) errBlock(result)
}else { } else {
uni.showModal({ uni.showModal({
content: text, content: text,
confirmText: '去设置', confirmText: '去设置',
...@@ -269,14 +276,14 @@ export function getSetting(scope, text, block, errBlock = () => {}) { ...@@ -269,14 +276,14 @@ export function getSetting(scope, text, block, errBlock = () => {}) {
}, },
}) })
} }
}).catch((e)=>{ }).catch((e) => {
console.log("requestAndroidPermission:error",e) console.log("requestAndroidPermission:error", e)
}) })
}
// #endif }
// #ifdef MP
// #endif
// #ifdef MP
uni.authorize({ uni.authorize({
scope: scope, scope: scope,
success: () => { success: () => {
...@@ -312,7 +319,7 @@ export function getSetting(scope, text, block, errBlock = () => {}) { ...@@ -312,7 +319,7 @@ export function getSetting(scope, text, block, errBlock = () => {}) {
}) })
}, },
}) })
// #endif // #endif
} }
// 自定义filter // 自定义filter
...@@ -597,3 +604,117 @@ export function formatCount(count) { ...@@ -597,3 +604,117 @@ export function formatCount(count) {
} }
return string return string
} }
// js将数字转换成万 并且保留两位小数
export function keepWFull(num) {
let s_x = 0;
// num=parseFloat(num)
if (num > 10000) {
let result = num / 10000;
result = Math.floor(result * 100) / 100;
s_x = result.toString(); //将数字转换为字符串
let pos_decimal = s_x.indexOf("."); //小数点的索引值
// 当整数时,pos_decimal=-1 自动补0
if (pos_decimal < 0) {
pos_decimal = s_x.length;
s_x += ".";
}
// 当数字的长度< 小数点索引+2时,补0
while (s_x.length <= pos_decimal + 2) {
s_x += "0";
}
s_x += "万";
} else {
if (!isNaN(parseInt(num))) {
s_x = num;
}
}
return s_x;
}
export const convertCurrency = (money) => {
//汉字的数字
var cnNums = new Array('零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖');
//基本单位
var cnIntRadice = new Array('', '拾', '佰', '仟');
//对应整数部分扩展单位
var cnIntUnits = new Array('', '万', '亿', '兆');
//对应小数部分单位
var cnDecUnits = new Array('角', '分', '毫', '厘');
//整数金额时后面跟的字符
var cnInteger = '整';
//整型完以后的单位
var cnIntLast = '元';
//最大处理的数字
var maxNum = 999999999999999.9999;
//金额整数部分
var integerNum;
//金额小数部分
var decimalNum;
//输出的中文金额字符串
var chineseStr = '';
//分离金额后用的数组,预定义
var parts;
if (money == '') {
return '';
}
money = parseFloat(money);
if (money >= maxNum) {
//超出最大处理数字
return '';
}
if (money == 0) {
chineseStr = cnNums[0] + cnIntLast + cnInteger;
return chineseStr;
}
//转换为字符串
money = money.toString();
if (money.indexOf('.') == -1) {
integerNum = money;
decimalNum = '';
} else {
parts = money.split('.');
integerNum = parts[0];
decimalNum = parts[1].substr(0, 4);
}
//获取整型部分转换
if (parseInt(integerNum, 10) > 0) {
var zeroCount = 0;
var IntLen = integerNum.length;
for (var i = 0; i < IntLen; i++) {
var n = integerNum.substr(i, 1);
var p = IntLen - i - 1;
var q = p / 4;
var m = p % 4;
if (n == '0') {
zeroCount++;
} else {
if (zeroCount > 0) {
chineseStr += cnNums[0];
}
//归零
zeroCount = 0;
chineseStr += cnNums[parseInt(n)] + cnIntRadice[m];
}
if (m == 0 && zeroCount < 4) {
chineseStr += cnIntUnits[q];
}
}
chineseStr += cnIntLast;
}
//小数部分
if (decimalNum != '') {
var decLen = decimalNum.length;
for (var i = 0; i < decLen; i++) {
var n = decimalNum.substr(i, 1);
if (n != '0') {
chineseStr += cnNums[Number(n)] + cnDecUnits[i];
}
}
}
if (chineseStr == '') {
chineseStr += cnNums[0] + cnIntLast + cnInteger;
} else if (decimalNum == '') {
chineseStr += cnInteger;
}
return chineseStr;
}
...@@ -9,7 +9,7 @@ export const minPopupOptions = [{ ...@@ -9,7 +9,7 @@ export const minPopupOptions = [{
}, },
{ {
label: '开收据', label: '开收据',
path: '/pages/maintain-bill/create', path: '/pages/maintain-bill/bill-style',
icon: 'weixiuzhangfapiao@3x.png', icon: 'weixiuzhangfapiao@3x.png',
type: '2', type: '2',
}, },
......
...@@ -71,19 +71,156 @@ export const tableOptions = [{ ...@@ -71,19 +71,156 @@ export const tableOptions = [{
export const billCountOptions = [{ export const billCountOptions = [{
value: "income", value: "number",
label: "账单", label: "账单",
}, },
{ {
value: "expense", value: "receivableAmount",
label: "应收", label: "应收",
}, },
{ {
value: "surplus", value: "actualAmount",
label: "实收", label: "实收",
}, },
{ {
value: "surplus", value: "arearAmount",
label: "欠款", label: "欠款",
}, },
]
export const voucherHeadOptions = [{
value: "number",
label: "单号",
},
{
value: "repairTime",
label: "时间",
},
{
value: "customer",
childrenValue:'name',
label: "客户",
},
{
value: "customer",
childrenValue:'phone',
label: "电话",
},
{
value: "address",
label: "客户地址",
},
]
export const voucherFooterOptions = [{
value: "stopInfo",
childrenValue:'lister',
label: "制表人",
},
{
value: "receivableAmount",
label: "应收金额",
currencySign:'¥',
},
{
value: "actualAmount",
label: "实收金额",
currencySign:'¥',
},
{
value: "arearAmount",
label: "欠款",
currencySign:'¥',
},
{
value: "stopInfo",
childrenValue:'phone',
label: "电话",
},
{
value: "stopInfo",
childrenValue:'address',
label: "地址",
},
]
export const tableCellOptions = [{
value: "index",
label: "序号",
width:"44rpx",
},
{
value: "name",
label: "商品/服务名称",
width:"154rpx",
},
{
value: "unit",
label: "单位",
width:"60rpx",
},
{
value: "number",
label: "数量",
width:"60rpx",
},
{
value: "unitPrice",
label: "单价",
width:"100rpx",
currencySign:'¥',
},
{
value: "total",
label: "金额",
width:"100rpx",
currencySign:'¥',
},
]
export const canvasTableCellOptions = [{
value: "index",
label: "序号",
width:"48rpx",
},
{
value: "name",
label: "商品/服务名称",
width:"142rpx",
},
{
value: "unit",
label: "单位",
width:"64rpx",
},
{
value: "number",
label: "数量",
width:"64rpx",
},
{
value: "unitPrice",
label: "单价",
width:"102rpx",
currencySign:'¥',
},
{
value: "total",
label: "金额",
width:"102rpx",
currencySign:'¥',
},
]
export const tableFooterOptions = [{
value: "upperCase",
label: "大写金额:",
width:"70%",
},
{
value: "lowerCase",
label: "(小写)",
width:"30%",
},
] ]
\ No newline at end of file
...@@ -78,5 +78,10 @@ export const shopSettingOptions = [{ ...@@ -78,5 +78,10 @@ export const shopSettingOptions = [{
label: '联系电话', label: '联系电话',
value: 'phone', value: 'phone',
path: "/pages/mine/shop-setting/shop-phone/shop-phone" path: "/pages/mine/shop-setting/shop-phone/shop-phone"
},
{
label: '制表人',
value: 'lister',
path: "/pages/mine/shop-setting/shop-lister/shop-lister"
} }
] ]
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