Commit 274a42b2 by 张立顺

feat:虚拟对公账户详情也开发

1 parent fc946905
const elTransition =
'0.3s height ease-in-out, 0.3s padding-top ease-in-out, 0.3s padding-bottom ease-in-out'
const Transition = {
'before-enter'(el) {
el.style.transition = elTransition
if (!el.dataset) el.dataset = {}
el.dataset.oldPaddingTop = el.style.paddingTop
el.dataset.oldPaddingBottom = el.style.paddingBottom
el.style.height = 0
el.style.paddingTop = 0
el.style.paddingBottom = 0
},
enter(el) {
el.dataset.oldOverflow = el.style.overflow
if (el.scrollHeight !== 0) {
el.style.height = el.scrollHeight + 'px'
el.style.paddingTop = el.dataset.oldPaddingTop
el.style.paddingBottom = el.dataset.oldPaddingBottom
} else {
el.style.height = ''
el.style.paddingTop = el.dataset.oldPaddingTop
el.style.paddingBottom = el.dataset.oldPaddingBottom
}
el.style.overflow = 'hidden'
},
'after-enter'(el) {
el.style.transition = ''
el.style.height = ''
el.style.overflow = el.dataset.oldOverflow
},
'before-leave'(el) {
if (!el.dataset) el.dataset = {}
el.dataset.oldPaddingTop = el.style.paddingTop
el.dataset.oldPaddingBottom = el.style.paddingBottom
el.dataset.oldOverflow = el.style.overflow
el.style.height = el.scrollHeight + 'px'
el.style.overflow = 'hidden'
},
leave(el) {
if (el.scrollHeight !== 0) {
el.style.transition = elTransition
el.style.height = 0
el.style.paddingTop = 0
el.style.paddingBottom = 0
}
},
'after-leave'(el) {
el.style.transition = ''
el.style.height = ''
el.style.overflow = el.dataset.oldOverflow
el.style.paddingTop = el.dataset.oldPaddingTop
el.style.paddingBottom = el.dataset.oldPaddingBottom
}
}
export default {
name: 'collapseTransition',
functional: true,
render(h, { children }) {
const data = {
on: Transition
}
return h('transition', data, children)
}
}
// 将该代码定义为一个js文件
const resize = {
bind(el, binding) {
let width = ''
let height = ''
function isResize() {
const style = document.defaultView.getComputedStyle(el)
if (width !== style.width || height !== style.height) {
binding.value()
}
width = style.width
height = style.height
}
el._vueSetInterval_ = setInterval(isResize, 300)
},
unbind(el) {
clearInterval(el._vueSetInterval_)
}
}
export default resize
...@@ -111,12 +111,11 @@ export default { ...@@ -111,12 +111,11 @@ export default {
} }
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
#baseDialog {
overflow: hidden;
}
::v-deep .el-dialog { ::v-deep .el-dialog {
height: 90vh; // height: 90vh;
border-radius: 6px; border-radius: 6px;
// padding: 0;
overflow: hidden;
.el-dialog__header { .el-dialog__header {
// box-shadow: 0px 0px 5px 0px rgba(136, 152, 157, 0.3); // box-shadow: 0px 0px 5px 0px rgba(136, 152, 157, 0.3);
border-bottom: solid 1px #e6e6e6; border-bottom: solid 1px #e6e6e6;
...@@ -137,10 +136,11 @@ export default { ...@@ -137,10 +136,11 @@ export default {
} }
} }
.el-dialog__body { .el-dialog__body {
padding-left: 25px; box-sizing: border-box;
// padding-left: 25px;
color: #333; color: #333;
height: calc(100% - 121px); max-height: calc(100% - 121px);
overflow: scroll; // height: calc(100% - 121px);
} }
.roleTitle { .roleTitle {
margin-right: 40px; margin-right: 40px;
......
...@@ -45,7 +45,7 @@ axios({ ...@@ -45,7 +45,7 @@ axios({
}).then(({ data }) => { }).then(({ data }) => {
baseConfig = data baseConfig = data
// 先本地切换到测试环境接口 // 先本地切换到测试环境接口
data.axios.baseURL = 'http://dj.test.glsx.com.cn/rop-dj-smartcarlife/router' // data.axios.baseURL = 'http://dj.test.glsx.com.cn/rop-dj-smartcarlife/router'
new Vue({ new Vue({
router, router,
store, store,
......
import Vue from 'vue' import Vue from 'vue'
import VueRouter from 'vue-router' import VueRouter from 'vue-router'
// 进度条 // 进度条
import NProgress from 'nprogress' import NProgress from 'nprogress'
import 'nprogress/nprogress.css' import 'nprogress/nprogress.css'
import store from '@/store/index' import store from '@/store/index'
import util from '@/libs/util.js' import util from '@/libs/util.js'
// 路由数据 // 路由数据
import routes from './routes' import routes from './routes'
const originalPush = VueRouter.prototype.push // 解决连续点击路由异常问题 limin const originalPush = VueRouter.prototype.push // 解决连续点击路由异常问题 limin
VueRouter.prototype.push = function push(location) { VueRouter.prototype.push = function push(location, onResolve, onReject) {
return originalPush.call(this, location) && originalPush.call(this, location).catch(err => err) // 解决Uncaught (in promise) 控制台报错问题
} if (onResolve || onReject) {
Vue.use(VueRouter) return originalPush.call(this, location, onResolve, onReject)
}
// 导出路由 在 main.js 里使用 return originalPush.call(this, location).catch(err => err)
const router = new VueRouter({ // return originalPush.call(this, location) && originalPush.call(this, location).catch(err => err)
routes }
}) Vue.use(VueRouter)
const setCurrent = path => { // 导出路由 在 main.js 里使用
return new Promise(async resolve => { const router = new VueRouter({
path !== '/login' && await store.dispatch('d2admin/page/currentSet', path) routes
resolve() })
})
} const setCurrent = path => {
return new Promise(async resolve => {
/** path !== '/login' && (await store.dispatch('d2admin/page/currentSet', path))
* 路由拦截 resolve()
* 权限验证 })
*/ }
router.beforeEach(async(to, from, next) => {
const source = store.state.d2admin.auth.source /**
// 确认已经加载多标签页数据 https://github.com/d2-projects/d2-admin/issues/201 * 路由拦截
// await store.dispatch('d2admin/page/isLoaded') * 权限验证
// 确认已经加载组件尺寸设置 https://github.com/d2-projects/d2-admin/issues/198 */
// await store.dispatch('d2admin/size/isLoaded') router.beforeEach(async (to, from, next) => {
// 设置当前页 下次登录 默认打开此页面 const source = store.state.d2admin.auth.source
await setCurrent(to.fullPath) // 确认已经加载多标签页数据 https://github.com/d2-projects/d2-admin/issues/201
// 进度条 // await store.dispatch('d2admin/page/isLoaded')
NProgress.start() // 确认已经加载组件尺寸设置 https://github.com/d2-projects/d2-admin/issues/198
// 关闭搜索面板 // await store.dispatch('d2admin/size/isLoaded')
store.commit('d2admin/search/set', false) // 设置当前页 下次登录 默认打开此页面
if (from.name === null && to.path !== '/login' && !source) { // 页面刷新 动态路由会失效 初始化路由与左侧菜单栏 await setCurrent(to.fullPath)
await store.dispatch('d2admin/auth/init') // 进度条
await store.dispatch('d2admin/account/load') NProgress.start()
next(to.path) // 关闭搜索面板
} else { store.commit('d2admin/search/set', false)
if (store.state.d2admin.user.info) { // sessionstorage 用户存在继续当前路由 不存在 跳转登录 防止页面关闭还可以打开页面 if (from.name === null && to.path !== '/login' && !source) {
next() // 页面刷新 动态路由会失效 初始化路由与左侧菜单栏
} else { await store.dispatch('d2admin/auth/init')
if (to.path === '/login') { // 如果是登录页面路径,就直接next() await store.dispatch('d2admin/account/load')
next() next(to.path)
} else { // 不然就跳转到登录; } else {
await store.dispatch('d2admin/account/logout') if (store.state.d2admin.user.info) {
next('/login') // sessionstorage 用户存在继续当前路由 不存在 跳转登录 防止页面关闭还可以打开页面
} next()
} } else {
} if (to.path === '/login') {
}) // 如果是登录页面路径,就直接next()
next()
router.afterEach(to => { } else {
// 进度条 // 不然就跳转到登录;
NProgress.done() await store.dispatch('d2admin/account/logout')
// 多页控制 打开新的页面 next('/login')
store.dispatch('d2admin/page/open', to) }
// 更改标题 }
util.title(to.meta.title) }
// 保存当前页面meta信息 })
store.dispatch('d2admin/auth/setCurrentPageMeta', to.meta)
}) router.afterEach(to => {
// 进度条
export const ResetRouter = () => new VueRouter({ NProgress.done()
routes // 多页控制 打开新的页面
}) store.dispatch('d2admin/page/open', to)
// 更改标题
export default router util.title(to.meta.title)
// 保存当前页面meta信息
store.dispatch('d2admin/auth/setCurrentPageMeta', to.meta)
})
export const ResetRouter = () =>
new VueRouter({
routes
})
export default router
<!-- 商品管理 --> <!-- 商品管理 -->
<template> <template>
<d2-container class="commodity"> <d2-container class="commodity">
<div <div class="header"
class="header" slot="header">
slot="header" <d2-search ref="showSearch"
> class="show-search"
<d2-search :searchForm="searchForm"
ref="showSearch" :formData="showFormData">
class="show-search"
:searchForm="searchForm"
:formData="showFormData"
>
<!-- <p> <!-- <p>
<el-input <el-input
size="small" size="small"
...@@ -22,84 +18,60 @@ ...@@ -22,84 +18,60 @@
</p> --> </p> -->
</d2-search> </d2-search>
<div class="up-btns"> <div class="up-btns">
<el-button <el-button :id="tableParams.btnId"
:id="tableParams.btnId" size="small"
size="small" type="primary">查询</el-button>
type="primary" <el-button size="small"
>查询</el-button> @click="handleReset">重置</el-button>
<el-button
size="small"
@click="handleReset"
>重置</el-button>
</div> </div>
</div> </div>
<div class="d2-container-content"> <div class="d2-container-content">
<d2-table-header> <d2-table-header>
<span slot="left"> <span slot="left">
<auth-button <auth-button category="Button"
category="Button" style="{display: inline-block}"
style="{display: inline-block}" :showBtnIds="['9030201']"></auth-button>
showBtnIds="['9030201']"
></auth-button>
</span> </span>
<auth-button <auth-button category="Button"
category="Button" style="{display: inline-block}"
style="{display: inline-block}" :showBtnIds="['9030202']"></auth-button>
showBtnIds="['9030202']"
></auth-button>
</d2-table-header> </d2-table-header>
<d2-table <d2-table ref="commodityTable"
ref="commodityTable" :hasNum="false"
:hasNum="false" :searchForm="searchForm"
:searchForm="searchForm" :tableParams="tableParams"
:tableParams="tableParams" :getListApi="getListApi"
:getListApi="getListApi" :beforeSearchFn="beforeSearchFn">
:beforeSearchFn="beforeSearchFn" <img slot="img"
> slot-scope="scope"
<img class="pro-img"
slot="img" :src="scope.scope.goodsInfo.thumbUrl" />
slot-scope="scope" <template v-if="Object.keys(scope.scope).includes('upgradeGoodsList')"
class="pro-img" slot="auth-button"
:src="scope.scope.goodsInfo.thumbUrl" slot-scope="scope">
/> <el-button type="text"
<template size="mini"
v-if="Object.keys(scope.scope).includes('upgradeGoodsList')" style="margin-right: 10px;"
slot="auth-button" @click="handleCommodityDetail(scope.scope)">查看</el-button>
slot-scope="scope" <auth-button :data="scope.scope"></auth-button>
>
<el-button
type="text"
size="mini"
style="margin-right: 10px;"
@click="handleCommodityDetail(scope.scope)"
>查看</el-button>
<auth-button
:data="scope.scope"
></auth-button>
</template> </template>
</d2-table> </d2-table>
</div> </div>
<d2-dialog <d2-dialog v-if="detailVisible"
:title="detailData ? detailData.goodsInfo.goodsName : ''" :title="detailData ? detailData.goodsInfo.goodsName : ''"
:className="storeDetail" :className="storeDetail"
:isVisible.sync="detailVisible" :isVisible.sync="detailVisible"
:showClose="showClose" :showClose="showClose"
noCancel="true" noCancel="true"
@closeDialog="handleDetailClose" @closeDialog="handleDetailClose"
@confirmDialog="handleDetailClose" @confirmDialog="handleDetailClose">
> <store-detail :detailData="detailData"></store-detail>
<store-detail
v-if="detailVisible"
:detailData="detailData"
></store-detail>
</d2-dialog> </d2-dialog>
<!-- 查看面板 --> <!-- 查看面板 -->
<drawer-detail <drawer-detail v-if="drawerDetailVisible"
v-if="drawerDetailVisible" :drawerDetailVisible="drawerDetailVisible"
:drawerDetailVisible="drawerDetailVisible" :commodityInfoId="commodityDetailInfoId"
:commodityInfoId="commodityDetailInfoId" @handleDrawerClose="handleDrawerClose"></drawer-detail>
@handleDrawerClose="handleDrawerClose"
></drawer-detail>
</d2-container> </d2-container>
</template> </template>
......
...@@ -42,12 +42,14 @@ ...@@ -42,12 +42,14 @@
v-if="accountDetailVisible" v-if="accountDetailVisible"
@confirmDialog="handleDetailClose" @confirmDialog="handleDetailClose"
noCancel="true" --> noCancel="true" -->
<!-- v-if="accountDetailVisible" -->
<baseDialog :isShow.sync="accountDetailVisible" <baseDialog :isShow.sync="accountDetailVisible"
:config="dialogConfig.setting" :config="dialogConfig.setting"
:dialogConfig="dialogConfig.config" :dialogConfig="dialogConfig.config"
@closeDialog="handleDetailClose"> @closeDialog="handleDetailClose">
<!-- <span>test</span> --> <!-- <span>test</span> -->
<account-detail :accountDetailVisible="accountDetailVisible" <account-detail v-if="accountDetailVisible"
:accountDetailVisible="accountDetailVisible"
:merchantRow="merchantRow"></account-detail> :merchantRow="merchantRow"></account-detail>
</baseDialog> </baseDialog>
...@@ -299,7 +301,7 @@ export default { ...@@ -299,7 +301,7 @@ export default {
}, },
handleDetailClose() { handleDetailClose() {
console.log('visible') // console.log('visible')
this.accountDetailVisible = !this.accountDetailVisible this.accountDetailVisible = !this.accountDetailVisible
} }
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!