123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142 |
- <template>
- <div class="home">
- <a-alert :message="message" type="info" />
- <!-- 重置密码 -->
- <a-modal
- class="resetPwdModal"
- title="重置密码"
- width="60%"
- centered
- :footer="null"
- :closable="false"
- :maskClosable="false"
- :destroyOnClose="true"
- @cancel="openResetPwd=false"
- v-model="openResetPwd">
- <ResetPwd />
- </a-modal>
- <!-- 产品上线提醒 -->
- <a-modal
- class="newProductTips"
- :title="'产品'+(onlineFalg=='1'?'上':'下')+'线提醒'"
- :width="800"
- centered
- :footer="null"
- :maskClosable="false"
- :destroyOnClose="true"
- @cancel="cancelProductTips"
- v-model="openNewProduct">
- <newProduct :onlineFalg="onlineFalg" @seeMore="seeMore"></newProduct>
- </a-modal>
- </div>
- </template>
- <script>
- import { commonMixin } from '@/utils/mixin'
- import { mapGetters, mapActions } from 'vuex'
- import ResetPwd from '@/views/user/ResetPwd.vue'
- import newProduct from '@/views/productManagement/newProduct/modal.vue'
- import { queryNewProductPage } from '@/api/product'
- import { getYyMenuList } from '@/api/menu.js'
- export default {
- name: 'Home',
- mixins: [commonMixin],
- components: { ResetPwd, newProduct },
- data () {
- return {
- message: '欢迎登录' + process.env.VUE_APP_PRO_NAME,
- openResetPwd: false, // 重置密码是否显示
- openNewProduct: false,
- onlineFalg: '1' // 上下线标识 1为上线,0为下线
- }
- },
- computed: {
- ...mapGetters(['mustChangePwd'])
- },
- created () {
- },
- methods: {
- ...mapActions(['GetEmployeeList', 'getLookUpDataByCode']),
- // 获取菜单树列表
- getYyMenuList () {
- getYyMenuList().then(res => {
- if (res.status == 200) {
- this.$store.state.app.authMenusList = res.data
- }
- })
- },
- hasNewProduct () {
- this.GetEmployeeList()
- queryNewProductPage({ pageNo: 1, pageSize: 20, onlineFalg: this.onlineFalg }).then(res => {
- if (res.status == 200) {
- if (res.data.count > 0) {
- this.openNewProduct = true
- } else {
- if (this.onlineFalg == '1') {
- this.onlineFalg = '0'
- this.hasNewProduct()
- }
- }
- }
- })
- },
- // 查看更多产品
- seeMore () {
- this.openNewProduct = false
- this.$router.push({ name: this.onlineFalg == 1 ? 'newProductList' : 'oldProductList', params: { onlineFalg: this.onlineFalg, type: 'newProduct' } })
- },
- // 关闭弹框
- cancelProductTips () {
- const _this = this
- this.openNewProduct = false
- if (this.onlineFalg == '1') {
- this.onlineFalg = '0'
- setTimeout(() => { _this.hasNewProduct() }, 100)
- }
- }
- },
- beforeRouteEnter (to, from, next) {
- next(vm => {
- // 判断登录用户是否重置过密码(首次登陆需强制重置密码)
- if (vm.mustChangePwd == 0) {
- vm.openResetPwd = false
- if (from.name == 'login') {
- // 判断是否有新产品上线
- vm.hasNewProduct()
- }
- } else {
- vm.openResetPwd = true
- }
- // 退货原因列表
- vm.getLookUpDataByCode({
- code: 'GOOD_PRODUCT_RETURN',
- key: 'goodReturnReason',
- isEnable: 1
- })
- vm.getLookUpDataByCode({
- code: 'DEFECTIVE_PRODUCT_RETURN',
- key: 'defectiveReturnReason',
- isEnable: 1
- })
- // 菜单数据
- vm.getYyMenuList()
- vm.$store.state.app.priceAuthOptions = [
- { label: '售价', value: 'salesPrice' },
- { label: '成本价', value: 'costPrice' },
- { label: '省级价', value: 'provincePrice' },
- { label: '市级价', value: 'cityPrice' },
- { label: '特约价', value: 'specialPrice' },
- { label: '终端价', value: 'terminalPrice' },
- { label: '车主价', value: 'carOwnersPrice' }
- ]
- })
- }
- }
- </script>
- <style scoped>
- .home {
- /* width: 900px;
- margin: 0 auto;
- padding: 25px 0; */
- }
- </style>
|