123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344 |
- <template>
- <view v-if="!refreshPage && !$isEmpty(detailData)" class="uni-app">
- <view class="status-bar" />
- <wk-nav-bar
- :command-list="commandList"
- :refresh-prev="refreshPrevPage"
- title="回款详情"
- theme="white"
- class="nav-bar"
- @command="handleCommand" />
- <scroll-view
- :scroll-y="true"
- class="main-container scroll-view-hook">
- <view class="header-top">
- <view class="bg linear-gradient" />
- <view class="card">
- <view class="title-cell">
- <image :src="$static('images/crm/gray_receivables.png')" class="type-icon" />
- <view class="title-text">
- {{ detailData.number || '' }}
- </view>
- <view
- v-if="showCheckStatus"
- :style="{
- backgroundColor: statusObj.bg,
- color: statusObj.color
- }"
- class="title-status">
- <text
- :class="statusObj.icon"
- class="wk" />
- <text>{{ statusObj.label }}</text>
- </view>
- </view>
- <view class="main-info">
- <view class="info-item">
- <text class="label">
- 回款金额:
- </text>
- <text class="value">
- {{ detailData.money ? splitNumber(detailData.money) : '--' }}
- </text>
- </view>
- <view class="info-item">
- <text class="label">
- 回款方式:
- </text>
- <text class="value">
- {{ detailData.returnType || '--' }}
- </text>
- </view>
- <view class="info-item">
- <text class="label">
- 回款时间:
- </text>
- <text class="value">
- {{ detailData.returnTime || '--' }}
- </text>
- </view>
- </view>
- <view class="main-info">
- <flow-progress
- v-if="detailData"
- :type="comType"
- :detail-id="id"
- :detail-data="detailData" />
- </view>
-
- <view
- class="relevance-cell"
- @click="handleToCustomer">
- <image :src="$static('images/application/customer.png')" class="cell-icon" />
- <text class="cell-body">
- {{ detailData.customerName }}
- </text>
- <text class="cell-link wk wk-arrow-right" />
- </view>
- <view
- v-if="auditInfo && auditInfo.isCheck === 1"
- class="check-box">
- <view class="btn success" @click="handleAuditAction('pass')">
- <text class="wk wk-check-fill icon" />
- <text>通过</text>
- </view>
- <view class="btn error" @click="handleAuditAction('refuse')">
- <text class="wk wk-close-fill icon" />
- <text>拒绝</text>
- </view>
- </view>
- </view>
- </view>
- <detail-base-info
- v-if="id"
- :detail-id="id"
- :detail-data="detailData"
- :type="comType"
- class="detail-container" />
- </scroll-view>
- <uni-popup ref="popup" type="dialog">
- <uni-popup-dialog
- :content="dialogMsg"
- type="warning"
- @confirm="handleDialogConfirm" />
- </uni-popup>
- </view>
- </template>
- <script>
- import { QueryById, DeleteByIds } from 'API/crm/received'
- import { QueryExamineRecordList, AuditExamine } from 'API/examine'
- import DetailBaseInfo from '../components/detailSection/baseInfo'
- import FlowProgress from '../components/customFlow/flowProgress'
- import { mapGetters } from 'vuex'
- import { splitNumber } from '@/utils/lib.js'
- import detailMixins from '../mixins/detail.js'
- export default {
- name: 'ReceivedDetail',
- components: {
- DetailBaseInfo,
- FlowProgress
- },
- mixins: [detailMixins],
- data() {
- return {
- id: null,
- routerQuery: {},
- comType: 'crm_receivables',
- detailData: {},
- commandList: [],
- auditInfo: null
- }
- },
- computed: {
- ...mapGetters({
- calcStatus: 'base/calcStatus',
- userInfo: 'user/userInfo'
- }),
- showCheckStatus() {
- return this.detailData.hasOwnProperty('checkStatus') && this.detailData.examineRecordId
- },
- statusObj() {
- if (!this.showCheckStatus) return {}
- return this.calcStatus(this.detailData.checkStatus) || {}
- }
- },
- methods: {
- splitNumber(num) {
- return splitNumber(num)
- },
- /**
- * 获取详情
- */
- getDetail() {
- QueryById({receivablesId: this.id}).then(response => {
- this.detailData = response
- this.getAuditInfo()
- }).catch(() => {
- this.goBack()
- })
- },
- /**
- * 获取审批流
- */
- getAuditInfo() {
- if (!this.detailData.examineRecordId) {
- this.auditInfo = null
- this.renderCommands()
- return
- }
- QueryExamineRecordList({
- recordId: this.detailData.examineRecordId,
- ownerUserId: this.detailData.ownerUserId
- }).then(res => {
- this.auditInfo = res || null
- this.renderCommands()
- }).catch()
- },
- /**
- * 渲染更多操作选项
- */
- renderCommands() {
- this.commandList = [
- {label: '查看审批流', imgIcon: 'read', noCheck: true, value: 'read'},
- {label: '编辑', imgIcon: 'update', auth: 'crm.receivables.update', value: 'update'},
- {label: '删除', imgIcon: 'delete', auth: 'crm.receivables.delete', value: 'delete'},
- ]
- // 判断是否能够撤回审批
- let index = this.commandList.findIndex(item => item.label === '撤回审批')
- if (this.auditInfo && this.auditInfo.isRecheck === 1 && index === -1) {
- this.commandList.splice(1, 0, {
- label: '撤回审批',
- imgIcon: 'reset',
- noCheck: true,
- value: 'reset'
- })
- } else if (this.auditInfo && this.auditInfo.isRecheck !== 1 && index !== -1) {
- this.commandList.splice(index, 1)
- }
- index = null
- // 如果没有审批流则删除查看审批流
- index = this.commandList.findIndex(item => item.value === 'read')
- if (index !== -1 && !this.detailData.examineRecordId) {
- this.commandList.splice(index, 1)
- }
- index = null
- const checkStatus = this.detailData.checkStatus
- // 判断是否能编辑
- index = this.commandList.findIndex(item => item.value === 'update')
- if (index !== -1) {
- // 审核拒绝 审核撤回 未提交 才能编辑
- // if (
- // this.userInfo.userId !== this.detailData.createUserId ||
- // (![2, 4, 5].includes(checkStatus) && this.detailData.examineRecordId)) {
- // this.commandList.splice(index, 1)
- // }
- if (![2, 4, 5].includes(checkStatus) && this.detailData.examineRecordId) {
- this.commandList.splice(index, 1)
- }
- }
- index = null
- // 判断是否能删除
- index = this.commandList.findIndex(item => item.value === 'delete')
- if (index !== -1) {
- // 已撤回 未提交 作废
- // if (![4, 5, 8].includes(checkStatus)) {
- if (![4, 5, 8].includes(checkStatus) && this.detailData.examineRecordId) {
- this.commandList.splice(index, 1)
- }
- }
- },
- /**
- * 跳转到客户
- */
- handleToCustomer() {
- this.$Router.navigateTo({
- url: '/pages_crm/customer/detail',
- query: {
- id: this.detailData.customerId
- }
- })
- },
- handleCommand(command) {
- this.commandValue = command.value
- switch (command.value) {
- case 'read':
- this.$Router.navigateTo({
- url: '/pages_crm/auditList',
- query: {
- id: this.detailData.examineRecordId,
- u_id: this.detailData.ownerUserId
- }
- })
- break
- case 'reset':
- this.handleAuditAction('cancel')
- break
- case 'update':
- this.handleEdit()
- break
- case 'delete':
- this.dialogMsg = '您确定要删除该回款吗?'
- this.$refs.popup.open()
- break
- }
- },
- handleDialogConfirm(next) {
- switch (this.commandValue) {
- case 'delete':
- this.handleDelete()
- break
- }
- next()
- },
- /**
- * 审核操作
- * @param action 审核动作
- */
- handleAuditAction(action) {
- getApp().globalData.auditInfo = this.auditInfo
- uni.$once('save-audit', this.handleAudit)
- this.$Router.navigateTo({
- url: '/pages_common/audit/index',
- query: {
- type: action
- }
- })
- },
- /**
- * 审核
- * @param form 审核信息
- */
- handleAudit(form) {
- let params = {
- typeId: this.id,
- recordId: this.detailData.examineRecordId,
- ...form
- }
- // console.log('audit', params)
- AuditExamine(params).then(() => {
- this.$toast(params.status === 4 ? '撤回成功' : '审核成功')
- this.refreshPrevPage = true
- this.$refreshAndToPrev(this)
- }).catch()
- },
- /**
- * 删除
- */
- handleDelete() {
- DeleteByIds([this.id]).then(() => {
- this.$toast('删除成功')
- this.$refreshAndToPrev(this)
- }).catch()
- }
- }
- }
- </script>
- <style scoped lang="scss">
- @import "../style/detail.scss";
- </style>
|