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) { ...@@ -62,3 +62,30 @@ export async function editeRepair(data) {
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 { ...@@ -155,7 +155,7 @@ export default {
}, },
handleClickConfirm() { handleClickConfirm() {
this.changeVisibleValue(false) this.changeVisibleValue(false)
this.$emit('confirm', this.selecte) this.$emit('confirm', this.select)
if (this.isShare) { if (this.isShare) {
// 去开通会员 // 去开通会员
uni.navigateTo({ uni.navigateTo({
...@@ -168,7 +168,7 @@ export default { ...@@ -168,7 +168,7 @@ export default {
}, },
handleClickCancel() { handleClickCancel() {
this.changeVisibleValue(false) this.changeVisibleValue(false)
this.$emit('cancel', this.selecte) this.$emit('cancel')
if (this.isShare) { if (this.isShare) {
// 分享领会员 // 分享领会员
} }
......
...@@ -441,6 +441,9 @@ export default { ...@@ -441,6 +441,9 @@ export default {
this.buttonLoading = true this.buttonLoading = true
editeRepair(this.form).then((res)=> { editeRepair(this.form).then((res)=> {
if (res.code == 0) { if (res.code == 0) {
if (this.billId) {
uni.$emit('maintain-bill-detail')
}
this.billId = res.data this.billId = res.data
this.toParticulars() this.toParticulars()
this.buttonLoading = false this.buttonLoading = false
......
...@@ -80,7 +80,9 @@ ...@@ -80,7 +80,9 @@
</template> </template>
<template v-slot:content> <template v-slot:content>
<view class="record-right-view"> <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 class="record-time">{{ item.createTime }}</view>
</view> </view>
</template> </template>
...@@ -141,13 +143,19 @@ ...@@ -141,13 +143,19 @@
:isSelect="currentPopInfo.isSelect" :isSelect="currentPopInfo.isSelect"
:bottomTip="currentPopInfo.bottomTip" :bottomTip="currentPopInfo.bottomTip"
/> />
<u-toast ref="uToast" />
</view> </view>
</template> </template>
<script> <script>
import NavbarRight from '@/components/navbar-right' import NavbarRight from '@/components/navbar-right'
import PopNormal from '@/components/pop-normal' 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 { export default {
components: { components: {
...@@ -157,7 +165,10 @@ export default { ...@@ -157,7 +165,10 @@ export default {
data() { data() {
return { return {
billId: '', billId: '',
info: {}, info: {
sendStatus: {},
settleState: {},
},
visible: false, visible: false,
current: 0, current: 0,
} }
...@@ -173,7 +184,10 @@ export default { ...@@ -173,7 +184,10 @@ export default {
return this.baseUrl + 'huishouye@3x.png' return this.baseUrl + 'huishouye@3x.png'
}, },
isSure() { isSure() {
return this.info.sendStatus.code == 'SURE' return (
this.info.sendStatus.code == 'SURE' ||
this.info.settleState.code == 'YES'
)
}, },
// sendStatus WAIT:未发送;WAIT_SURE:未确定;SURE:已确定 // sendStatus WAIT:未发送;WAIT_SURE:未确定;SURE:已确定
// settleState NO:未结清;YES:已结清 // settleState NO:未结清;YES:已结清
...@@ -373,11 +387,95 @@ export default { ...@@ -373,11 +387,95 @@ export default {
this.current = 1 this.current = 1
this.visible = true 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() {}, handleClickSure() {},
handleClickStatus() { handleClickStatus() {
this.current = 2 this.current = 2
this.visible = true 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() { handleClickHome() {
this.$u.route({ this.$u.route({
url: '/pages/index/index', url: '/pages/index/index',
...@@ -396,10 +494,13 @@ export default { ...@@ -396,10 +494,13 @@ export default {
handleClickConfirm(select) { handleClickConfirm(select) {
if (this.current == 0) { if (this.current == 0) {
// 删除账单 // 删除账单
this.repairDelete(select)
} else if (this.current == 1) { } else if (this.current == 1) {
// 标记为已结清 // 标记为已结清
this.repairSettle()
} else if (this.current == 2) { } else if (this.current == 2) {
// 同步账单 // 同步账单
this.repairSync()
} }
}, },
handleClickPreview(index) { handleClickPreview(index) {
...@@ -441,7 +542,7 @@ export default { ...@@ -441,7 +542,7 @@ export default {
.content-view { .content-view {
height: 100%; height: 100%;
overflow: auto; overflow: auto;
padding: 24rpx 24rpx 44rpx 24rpx; padding: 16rpx 24rpx 44rpx 24rpx;
.status-view { .status-view {
font-weight: bold; font-weight: bold;
font-size: 40rpx; font-size: 40rpx;
......
...@@ -173,14 +173,14 @@ export default { ...@@ -173,14 +173,14 @@ export default {
}, },
onLoad() { onLoad() {
this.init() this.init()
uni.$on('maintain-bill-item', (res) => { uni.$on('maintain-bill-detail', (res) => {
this.updateItem(res.id, true) this.reloadList()
}) })
this._freshing = false this._freshing = false
this.reloadList() this.reloadList()
}, },
onUnload() { onUnload() {
uni.$off('maintain-bill-item') uni.$off('maintain-bill-detail')
}, },
onShow() {}, onShow() {},
methods: { methods: {
...@@ -336,14 +336,6 @@ export default { ...@@ -336,14 +336,6 @@ export default {
changeSearch() { changeSearch() {
this.reloadList() this.reloadList()
}, },
updateItem(id, state) {
for (var item of this.lists) {
if (item.id == id) {
item.echoMap.joinState = state
}
}
},
handleClickOut() { handleClickOut() {
this.visible = true this.visible = true
}, },
......
...@@ -320,6 +320,7 @@ export default { ...@@ -320,6 +320,7 @@ export default {
editeRepair(this.info) editeRepair(this.info)
.then((res) => { .then((res) => {
if (res.code == 0) { if (res.code == 0) {
uni.$emit('maintain-bill-detail')
this.toDetailPage() this.toDetailPage()
this.buttonLoading = false 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