Commit 2af55f25 by 胡悦

feat(权限管理): 添加学习中心权限弹窗组件及逻辑

在多个页面添加学习中心权限弹窗组件,替换原有的禁止提单检查逻辑
当用户被限制下单时显示学习中心弹窗,引导用户前往学习中心
1 parent ed57ab97
...@@ -116,6 +116,10 @@ ...@@ -116,6 +116,10 @@
</view> </view>
</template> </template>
</PublishPopup> </PublishPopup>
<!-- 学习中心权限弹窗 -->
<StudyPopup :show.sync="showStudyPermissionPopup" title="" :width="848" :height="870" :topImage="require('@/assets/images/common/warning-notice.png')" :topImageWidth="848" :topImageHeight="248" style="overflow: hidden">
<StudyCenterPermissionPopup :lockReason="lockReason" @confirm="handleStudyPermissionConfirm" />
</StudyPopup>
</view> </view>
</template> </template>
<script> <script>
...@@ -124,6 +128,8 @@ import { interceptionMixin } from '@/mixin/index' ...@@ -124,6 +128,8 @@ import { interceptionMixin } from '@/mixin/index'
import utils from '@/utils/utils' import utils from '@/utils/utils'
import { checkDailyReport, showNextModal } from '@/utils/modalUtils' import { checkDailyReport, showNextModal } from '@/utils/modalUtils'
import PublishPopup from '@/components/PublishPopup.vue' import PublishPopup from '@/components/PublishPopup.vue'
import StudyPopup from '@/components/StudyPopup.vue'
import StudyPopupContent from '@/components/StudyPopupContent.vue'
import { debounce } from 'lodash' import { debounce } from 'lodash'
export default { export default {
mixins: [interceptionMixin], mixins: [interceptionMixin],
...@@ -135,7 +141,9 @@ export default { ...@@ -135,7 +141,9 @@ export default {
} }
}, },
components: { components: {
PublishPopup PublishPopup,
StudyPopup,
StudyPopupContent
}, },
computed: { computed: {
payType() { payType() {
...@@ -190,7 +198,9 @@ export default { ...@@ -190,7 +198,9 @@ export default {
key: 'orderTime' key: 'orderTime'
} }
], ],
localUserInfo: null localUserInfo: null,
showStudyPermissionPopup: false,
lockReason: ''
} }
}, },
mounted() { mounted() {
...@@ -228,7 +238,16 @@ export default { ...@@ -228,7 +238,16 @@ export default {
// 校验是否填写昨日日报 // 校验是否填写昨日日报
let staffCheck = await checkDailyReport() let staffCheck = await checkDailyReport()
if (staffCheck) return false if (staffCheck) return false
if (name == 'CreateOrder' && (await this.inspectionOfProhibitionBill())) return /**禁止提单 */ // if (name == 'CreateOrder' && (await this.inspectionOfProhibitionBill())) return /**禁止提单 */
if (name == 'CreateOrder') {
// 提示去学习中心弹窗
const res = await this.getLimitRecord()
if (res.lockOrder) {
this.showStudyPermissionPopup = true
this.lockReason = res.lockReason
return
}
}
// 是微信支付直接跳转确认页面 // 是微信支付直接跳转确认页面
if (userType == 2 && item?.selectPayType == 1) { if (userType == 2 && item?.selectPayType == 1) {
this.$emit('jump', 'ConfirmOrder', this.orderCardDetail) this.$emit('jump', 'ConfirmOrder', this.orderCardDetail)
...@@ -284,8 +303,14 @@ export default { ...@@ -284,8 +303,14 @@ export default {
this.$refs.recordOrderPopup.closePopup() this.$refs.recordOrderPopup.closePopup()
console.log('this.selectType', this.selectType) console.log('this.selectType', this.selectType)
if (this.selectType == 1) { if (this.selectType == 1) {
console.log(await this.inspectionOfProhibitionBill()) // if (await this.inspectionOfProhibitionBill()) return
if (await this.inspectionOfProhibitionBill()) return // 提示去学习中心弹窗
const res = await this.getLimitRecord()
if (res.lockOrder) {
this.showStudyPermissionPopup = true
this.lockReason = res.lockReason
return
}
this.$emit('jump', 'CreateOrder', { paramsData: this.orderCardDetail, type: 'createWithPay' }) this.$emit('jump', 'CreateOrder', { paramsData: this.orderCardDetail, type: 'createWithPay' })
} else if (this.selectType == 2 || this.selectType == 3) { } else if (this.selectType == 2 || this.selectType == 3) {
this.$emit('jump', 'DefeatOrder', { paramsData: this.orderCardDetail, type: 'createWithPay', isExpiredTraffic: this.selectType == 3 }) this.$emit('jump', 'DefeatOrder', { paramsData: this.orderCardDetail, type: 'createWithPay', isExpiredTraffic: this.selectType == 3 })
...@@ -309,7 +334,18 @@ export default { ...@@ -309,7 +334,18 @@ export default {
}, },
cardClick: debounce(function () { cardClick: debounce(function () {
this.jumpClick(this.orderCardDetail.status == 3 ? 'ConfirmOrder' : this.orderCardDetail.status == 1 ? 'CreateOrder' : 'OrderDetail', this.orderCardDetail) this.jumpClick(this.orderCardDetail.status == 3 ? 'ConfirmOrder' : this.orderCardDetail.status == 1 ? 'CreateOrder' : 'OrderDetail', this.orderCardDetail)
}, 300) }, 300),
// 跳转学习中心
handleStudyPermissionConfirm() {
this.showStudyPermissionPopup = false
uni.navigateBack({
success: () => {
setTimeout(() => {
uni.$emit('studyCenter')
}, 100)
}
})
}
} }
} }
</script> </script>
......
...@@ -57,6 +57,10 @@ ...@@ -57,6 +57,10 @@
text="当前页面暂未保存,是否确认退出" text="当前页面暂未保存,是否确认退出"
type="warning" type="warning"
></NoticePopup> ></NoticePopup>
<!-- 学习中心权限弹窗 -->
<StudyPopup :show.sync="showStudyPermissionPopup" title="" :width="848" :height="870" :topImage="require('@/assets/images/common/warning-notice.png')" :topImageWidth="848" :topImageHeight="248" style="overflow: hidden">
<StudyCenterPermissionPopup :lockReason="lockReason" @confirm="handleStudyPermissionConfirm" />
</StudyPopup>
</view> </view>
</template> </template>
...@@ -72,6 +76,8 @@ import UploadProofOfPayment from './components/UploadProofOfPayment.vue' ...@@ -72,6 +76,8 @@ import UploadProofOfPayment from './components/UploadProofOfPayment.vue'
import NoticePopup from '@/components/NoticePopup.vue' import NoticePopup from '@/components/NoticePopup.vue'
import dayjs from 'dayjs' import dayjs from 'dayjs'
import { interceptionMixin } from '@/mixin/index' import { interceptionMixin } from '@/mixin/index'
import StudyPopup from '@/components/StudyPopup.vue'
import StudyCenterPermissionPopup from '@/components/StudyCenterPermissionPopup.vue'
export default { export default {
mixins: [interceptionMixin], mixins: [interceptionMixin],
...@@ -84,7 +90,9 @@ export default { ...@@ -84,7 +90,9 @@ export default {
ConfirmOrder, ConfirmOrder,
NoticePopup, NoticePopup,
UploadProofOfPayment, UploadProofOfPayment,
OrderDetail OrderDetail,
StudyPopup,
StudyCenterPermissionPopup
}, },
data () { data () {
return { return {
...@@ -93,7 +101,9 @@ export default { ...@@ -93,7 +101,9 @@ export default {
endDate: dayjs().format('YYYY-MM-DD'), endDate: dayjs().format('YYYY-MM-DD'),
currentDate: dayjs().format('YYYY-MM-DD'), currentDate: dayjs().format('YYYY-MM-DD'),
currentMonth: dayjs().format('YYYY-MM'), currentMonth: dayjs().format('YYYY-MM'),
selectedDays: [] selectedDays: [],
lockReason: '',
showStudyPermissionPopup: false
} }
}, },
onLoad (options) { onLoad (options) {
...@@ -112,7 +122,16 @@ export default { ...@@ -112,7 +122,16 @@ export default {
async entranceClick (item) { async entranceClick (item) {
if(this.toolComponentName == item.name) return if(this.toolComponentName == item.name) return
const noInterceptPage = ['DailyReport'] const noInterceptPage = ['DailyReport']
if (!noInterceptPage.includes(item.name) && ((await this.checkDailyReport()) || (await this.inspectionOfProhibitionBill()))) return // 原禁止提单inspectionOfProhibitionBill方法被替换getLimitRecord
// if (!noInterceptPage.includes(item.name) && ((await this.checkDailyReport()) || (await this.inspectionOfProhibitionBill()))) return
if (!noInterceptPage.includes(item.name) && ((await this.checkDailyReport()))) return
// 提示去学习中心弹窗
const res = await this.getLimitRecord()
if (res.lockOrder) {
this.showStudyPermissionPopup = true
this.lockReason = res.lockReason
return
}
// 保存当前选择的组件信息,但不立即切换 // 保存当前选择的组件信息,但不立即切换
const selectedItem = item const selectedItem = item
if (this.toolComponentName === selectedItem.name && (!this.transmissionOfData || this.transmissionOfData.type !== 'supplementOrder')) return if (this.toolComponentName === selectedItem.name && (!this.transmissionOfData || this.transmissionOfData.type !== 'supplementOrder')) return
...@@ -164,6 +183,17 @@ export default { ...@@ -164,6 +183,17 @@ export default {
if (val) { if (val) {
this.transmissionOfData = val this.transmissionOfData = val
} }
},
// 跳转学习中心
handleStudyPermissionConfirm() {
this.showStudyPermissionPopup = false
uni.navigateBack({
success: () => {
setTimeout(() => {
uni.$emit('studyCenter')
}, 100)
}
})
} }
} }
} }
......
...@@ -24,6 +24,11 @@ ...@@ -24,6 +24,11 @@
</view> </view>
</view> </view>
<NoticePopup ref="notice" title="重要提示" text="当前页面暂未保存,是否确认退出" type="warning"></NoticePopup> <NoticePopup ref="notice" title="重要提示" text="当前页面暂未保存,是否确认退出" type="warning"></NoticePopup>
<!-- 学习中心权限弹窗 -->
<StudyPopup :show.sync="showStudyPermissionPopup" title="" :width="848" :height="870" :topImage="require('@/assets/images/common/warning-notice.png')" :topImageWidth="848" :topImageHeight="248" style="overflow: hidden">
<StudyCenterPermissionPopup :lockReason="lockReason" @confirm="handleStudyPermissionConfirm" />
</StudyPopup>
</view> </view>
</template> </template>
...@@ -39,6 +44,8 @@ import NoticePopup from '@/components/NoticePopup.vue' ...@@ -39,6 +44,8 @@ import NoticePopup from '@/components/NoticePopup.vue'
import dayjs from 'dayjs' import dayjs from 'dayjs'
import { interceptionMixin } from '@/mixin/index' import { interceptionMixin } from '@/mixin/index'
import UpdateOrderInfo from './components/UpdateOrderInfo.vue' import UpdateOrderInfo from './components/UpdateOrderInfo.vue'
import StudyPopup from '@/components/StudyPopup.vue'
import StudyCenterPermissionPopup from '@/components/StudyCenterPermissionPopup.vue'
export default { export default {
mixins: [interceptionMixin], mixins: [interceptionMixin],
...@@ -51,7 +58,9 @@ export default { ...@@ -51,7 +58,9 @@ export default {
NoticePopup, NoticePopup,
UploadProofOfPayment, UploadProofOfPayment,
OrderDetail, OrderDetail,
UpdateOrderInfo UpdateOrderInfo,
StudyPopup,
StudyCenterPermissionPopup
}, },
data() { data() {
return { return {
...@@ -60,7 +69,9 @@ export default { ...@@ -60,7 +69,9 @@ export default {
endDate: dayjs().format('YYYY-MM-DD'), endDate: dayjs().format('YYYY-MM-DD'),
currentDate: dayjs().format('YYYY-MM-DD'), currentDate: dayjs().format('YYYY-MM-DD'),
currentMonth: dayjs().format('YYYY-MM'), currentMonth: dayjs().format('YYYY-MM'),
selectedDays: [] selectedDays: [],
lockReason: '',
showStudyPermissionPopup: false
} }
}, },
onLoad(options) { onLoad(options) {
...@@ -79,7 +90,15 @@ export default { ...@@ -79,7 +90,15 @@ export default {
async entranceClick(item) { async entranceClick(item) {
if(this.toolComponentName == item.name) return if(this.toolComponentName == item.name) return
const noInterceptPage = ['DailyReport'] const noInterceptPage = ['DailyReport']
if (!noInterceptPage.includes(item.name) && ((await this.checkDailyReport()) || (await this.inspectionOfProhibitionBill()))) return // if (!noInterceptPage.includes(item.name) && ((await this.checkDailyReport()) || (await this.inspectionOfProhibitionBill()))) return
if (!noInterceptPage.includes(item.name) && ((await this.checkDailyReport()))) return
// 提示去学习中心弹窗
const res = await this.getLimitRecord()
if (res.lockOrder) {
this.showStudyPermissionPopup = true
this.lockReason = res.lockReason
return
}
// 保存当前选择的组件信息,但不立即切换 // 保存当前选择的组件信息,但不立即切换
const selectedItem = item const selectedItem = item
if (this.toolComponentName === selectedItem.name && (!this.transmissionOfData || this.transmissionOfData.type !== 'supplementOrder')) return if (this.toolComponentName === selectedItem.name && (!this.transmissionOfData || this.transmissionOfData.type !== 'supplementOrder')) return
...@@ -130,6 +149,17 @@ export default { ...@@ -130,6 +149,17 @@ export default {
if (val) { if (val) {
this.transmissionOfData = val this.transmissionOfData = val
} }
},
// 跳转学习中心
handleStudyPermissionConfirm() {
this.showStudyPermissionPopup = false
uni.navigateBack({
success: () => {
setTimeout(() => {
uni.$emit('studyCenter')
}, 100)
}
})
} }
} }
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!