Commit cf4364c8 by Lin

fix(customerPages):更新接待按钮的逻辑和状态映射

- 重构了根据客户状态启用“开始接待”按钮的逻辑。
- 更新了状态映射,新增了“战败”和“已退款”两种状态,并对应设置相应类型。
- 引入了一个计算属性,以简化对接待按钮禁用状态的检查。
1 parent 3113698b
...@@ -181,7 +181,7 @@ ...@@ -181,7 +181,7 @@
<view class="btns flex"> <view class="btns flex">
<view class="btn cancel" @click="submitCustomerProfileAPI">提交</view> <view class="btn cancel" @click="submitCustomerProfileAPI">提交</view>
<template v-if="sceneType != 7"> <template v-if="sceneType != 7">
<view :class="['btn', { disabled: customerInfo.customerStatus==2?true:false }]" @click="startReception">开始接待</view> <view :class="['btn', { disabled: isStartReceptionDisabled }]" @click="startReception">开始接待</view>
</template> </template>
</view> </view>
</view> </view>
...@@ -369,8 +369,9 @@ export default { ...@@ -369,8 +369,9 @@ export default {
} }
const statusMap = { const statusMap = {
1: { label: '待跟进', type: 'warning' }, 1: { label: '待跟进', type: 'warning' },
2: { label: '不升级', type: 'default' }, 2: { label: '已升级', type: 'success' },
4: { label: '已升级', type: 'success' } 3: { label: '战败', type: 'failed' },
4: { label: '已退款', type: 'refund' }
} }
const status = customerInfo.upgradeStatus ?? customerInfo.orderStatus const status = customerInfo.upgradeStatus ?? customerInfo.orderStatus
return statusMap[status] || null return statusMap[status] || null
...@@ -378,6 +379,9 @@ export default { ...@@ -378,6 +379,9 @@ export default {
sceneType () { sceneType () {
const { sceneType } = uni.$storage.get('userInfo') || {} const { sceneType } = uni.$storage.get('userInfo') || {}
return sceneType return sceneType
},
isStartReceptionDisabled () {
return [2, 3, 4].includes(Number(this.customerInfo.customerStatus))
} }
}, },
data () { data () {
...@@ -647,6 +651,7 @@ export default { ...@@ -647,6 +651,7 @@ export default {
if (label === '已升级') return 'success' if (label === '已升级') return 'success'
if (label === '待跟进') return 'warning' if (label === '待跟进') return 'warning'
if (label === '战败') return 'failed' if (label === '战败') return 'failed'
if (label === '已退款') return 'refund'
return 'default' return 'default'
}, },
initForm () { initForm () {
...@@ -722,7 +727,7 @@ export default { ...@@ -722,7 +727,7 @@ export default {
async startReception () { async startReception () {
const { sceneType, customerInfo } = this const { sceneType, customerInfo } = this
if (sceneType == 7) return // 二手车无接待功能 if (sceneType == 7) return // 二手车无接待功能
if (customerInfo.customerStatus == 2) return if (this.isStartReceptionDisabled) return
const submitted = await this.submitCustomerProfileAPI({ fromReception: true }) const submitted = await this.submitCustomerProfileAPI({ fromReception: true })
if (!submitted) return if (!submitted) return
uni.navigateBack({ uni.navigateBack({
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!