92 lines
2.9 KiB
Vue
92 lines
2.9 KiB
Vue
<template>
|
|
<view class="px-base" v-if="detail">
|
|
<CuNavbar title="合同详情">
|
|
<template #right>
|
|
<uv-icon color="white" @click="open" name="more-dot-fill"></uv-icon>
|
|
</template>
|
|
</CuNavbar>
|
|
<view class="mt-30rpx card-shadow bg-white rounded-19rpx px-base text-[#333333] text-27rpx">
|
|
<BaseData :data="detail" :colums="columns" />
|
|
</view>
|
|
|
|
<uv-action-sheet ref="pickerRef" :actions="actions" @select="confirmPicker" />
|
|
<uv-modal ref="modalRef" title="提示" content="确定删除吗?" @confirm="onSubmit" :showCancelButton="true"></uv-modal>
|
|
</view>
|
|
</template>
|
|
<script setup>
|
|
import CuNavbar from '@/components/cu-navbar/index'
|
|
import { http } from '@/utils/request'
|
|
import { onLoad } from '@dcloudio/uni-app'
|
|
import { ref } from 'vue'
|
|
import { timeFormat } from '@climblee/uv-ui/libs/function/index'
|
|
import BaseData from '../audits/base-data'
|
|
import statusFun from "@/utils/status"
|
|
|
|
const modalRef = ref(null)
|
|
const actions = ref([
|
|
{ name: '修改', value: 'edit', disabled: false },
|
|
{ name: '删除', value: 'delete', disabled: false },
|
|
{ name: '审核流程', value: 'check-logs', disabled: false }
|
|
])
|
|
const detail = ref()
|
|
const pickerRef = ref(null)
|
|
const id = ref(0)
|
|
|
|
const columns = [
|
|
{ title: '审核状态', dataIndex: 'workflow_check.check_status', format: (value) => statusFun(value, 'statusExpense', 'name') },
|
|
{ title: '上传人', dataIndex: 'employee.name' },
|
|
{ title: '所属门店', dataIndex: 'store.title' },
|
|
{ title: '电话号码', dataIndex: 'employee.phone' },
|
|
{ title: '上传时间', dataIndex: 'created_format' },
|
|
{ title: '合同名称', dataIndex: 'name' },
|
|
{ title: '合同内容', dataIndex: 'images', type: 'album' },
|
|
{ title: '未通过原因', dataIndex: 'workflow_check.check_remarks', labelPosition: 'top', isShow: (data) => data?.workflow_check?.check_status == 4 },
|
|
]
|
|
|
|
const open = () => {
|
|
pickerRef.value.open()
|
|
}
|
|
const confirmPicker = (e) => {
|
|
if (e.value == 'edit') {
|
|
return uni.navigateTo({
|
|
url: `/pages/contract/create?id=${id.value}`,
|
|
})
|
|
}
|
|
if (e.value == 'delete') {
|
|
return modalRef.value.open()
|
|
}
|
|
if (e.value == 'check-logs') {
|
|
return uni.navigateTo({
|
|
url: `/pages/audits/log?id=${detail.value.workflow_check.id}`
|
|
})
|
|
}
|
|
}
|
|
const onSubmit = async () => {
|
|
try {
|
|
await http.delete(`/agreements/${id.value}`)
|
|
uni.showToast({
|
|
title: '删除成功',
|
|
icon: 'none',
|
|
})
|
|
uni.$emit('refresh')
|
|
uni.navigateBack()
|
|
} catch (error) {
|
|
console.log(error)
|
|
} finally {
|
|
loading.value = false
|
|
}
|
|
}
|
|
onLoad((options) => {
|
|
id.value = options.id
|
|
http.get(`/agreements/${options.id}`).then((res) => {
|
|
detail.value = res
|
|
let status = res.workflow_check.check_status
|
|
if ([2, 3].indexOf(status) != -1) {
|
|
actions.value[0].disabled = true
|
|
actions.value[1].disabled = true
|
|
// actions.value.splice(0, 2)
|
|
}
|
|
})
|
|
})
|
|
</script>
|