Commit 11bec33b authored by Facius's avatar Facius

feat: 维修记账编辑及操作

parent 041f5d9e
Pipeline #2891 canceled with stages
......@@ -62,3 +62,30 @@ export async function editeRepair(data) {
data
})
}
// 结清费用
export async function repairSettle(data) {
return request({
url: `/rest/repair/settle`,
method: 'POST',
data
})
}
// 同步到日常记账
export async function repairSync(data) {
return request({
url: `/rest/repair/sync`,
method: 'POST',
data
})
}
// 删除账单
export async function repairDelete(data) {
return request({
url: `/rest/repair/delete`,
method: 'POST',
data
})
}
\ No newline at end of file
......@@ -155,7 +155,7 @@ export default {
},
handleClickConfirm() {
this.changeVisibleValue(false)
this.$emit('confirm', this.selecte)
this.$emit('confirm', this.select)
if (this.isShare) {
// 去开通会员
uni.navigateTo({
......@@ -168,7 +168,7 @@ export default {
},
handleClickCancel() {
this.changeVisibleValue(false)
this.$emit('cancel', this.selecte)
this.$emit('cancel')
if (this.isShare) {
// 分享领会员
}
......
......@@ -441,6 +441,9 @@ export default {
this.buttonLoading = true
editeRepair(this.form).then((res)=> {
if (res.code == 0) {
if (this.billId) {
uni.$emit('maintain-bill-detail')
}
this.billId = res.data
this.toParticulars()
this.buttonLoading = false
......
......@@ -80,7 +80,9 @@
</template>
<template v-slot:content>
<view class="record-right-view">
<view class="record-title">{{ operateTexts[item.type] }}</view>
<view class="record-title">{{
operateTexts[item.type.code]
}}</view>
<view class="record-time">{{ item.createTime }}</view>
</view>
</template>
......@@ -141,13 +143,19 @@
:isSelect="currentPopInfo.isSelect"
:bottomTip="currentPopInfo.bottomTip"
/>
<u-toast ref="uToast" />
</view>
</template>
<script>
import NavbarRight from '@/components/navbar-right'
import PopNormal from '@/components/pop-normal'
import { repairDetail } from '@/api/maintain/index.js'
import {
repairDetail,
repairSettle,
repairSync,
repairDelete,
} from '@/api/maintain/index.js'
export default {
components: {
......@@ -157,7 +165,10 @@ export default {
data() {
return {
billId: '',
info: {},
info: {
sendStatus: {},
settleState: {},
},
visible: false,
current: 0,
}
......@@ -173,7 +184,10 @@ export default {
return this.baseUrl + 'huishouye@3x.png'
},
isSure() {
return this.info.sendStatus.code == 'SURE'
return (
this.info.sendStatus.code == 'SURE' ||
this.info.settleState.code == 'YES'
)
},
// sendStatus WAIT:未发送;WAIT_SURE:未确定;SURE:已确定
// settleState NO:未结清;YES:已结清
......@@ -373,11 +387,95 @@ export default {
this.current = 1
this.visible = true
},
repairSettle() {
this.loading = true
repairSettle({
id: this.billId,
})
.then((res) => {
if (res.code == 0) {
this.repairDetail()
this.$refs.uToast.show({
title: '修改成功',
type: 'success',
duration: 1500,
callback: () => {},
})
}
this.loading = false
})
.catch((res) => {
this.loading = false
})
},
repairSync() {
this.loading = true
repairSync({
id: this.billId,
})
.then((res) => {
if (res.code == 0) {
this.repairDetail()
this.$refs.uToast.show({
title: '修改成功',
type: 'success',
duration: 1500,
callback: () => {},
})
}
this.loading = false
})
.catch((res) => {
this.loading = false
})
},
repairDelete(val) {
this.loading = true
repairSync({
id: this.billId,
deleteBookRecord: val,
})
.then((res) => {
if (res.code == 0) {
uni.$off('maintain-bill-detail')
uni.$emit('maintain-bill-detail')
this.$refs.uToast.show({
title: '删除成功',
type: 'success',
duration: 1500,
callback: () => {
// 跳转
this.toListPage()
},
})
}
this.loading = false
})
.catch((res) => {
this.loading = false
})
},
handleClickSure() {},
handleClickStatus() {
this.current = 2
this.visible = true
},
toListPage() {
var pages = getCurrentPages()
var index = 0
for (var item of pages) {
if (item.route.indexOf('pages/maintain-bill/index') != -1) {
console.log('---back----', pages.length - index)
uni.navigateBack({
delta: pages.length - index - 1,
})
return
}
index++
}
// 回首页
this.handleClickHome()
},
handleClickHome() {
this.$u.route({
url: '/pages/index/index',
......@@ -396,10 +494,13 @@ export default {
handleClickConfirm(select) {
if (this.current == 0) {
// 删除账单
this.repairDelete(select)
} else if (this.current == 1) {
// 标记为已结清
this.repairSettle()
} else if (this.current == 2) {
// 同步账单
this.repairSync()
}
},
handleClickPreview(index) {
......@@ -441,7 +542,7 @@ export default {
.content-view {
height: 100%;
overflow: auto;
padding: 24rpx 24rpx 44rpx 24rpx;
padding: 16rpx 24rpx 44rpx 24rpx;
.status-view {
font-weight: bold;
font-size: 40rpx;
......
......@@ -173,14 +173,14 @@ export default {
},
onLoad() {
this.init()
uni.$on('maintain-bill-item', (res) => {
this.updateItem(res.id, true)
uni.$on('maintain-bill-detail', (res) => {
this.reloadList()
})
this._freshing = false
this.reloadList()
},
onUnload() {
uni.$off('maintain-bill-item')
uni.$off('maintain-bill-detail')
},
onShow() {},
methods: {
......@@ -336,14 +336,6 @@ export default {
changeSearch() {
this.reloadList()
},
updateItem(id, state) {
for (var item of this.lists) {
if (item.id == id) {
item.echoMap.joinState = state
}
}
},
handleClickOut() {
this.visible = true
},
......
......@@ -320,6 +320,7 @@ export default {
editeRepair(this.info)
.then((res) => {
if (res.code == 0) {
uni.$emit('maintain-bill-detail')
this.toDetailPage()
this.buttonLoading = false
}
......
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