|
@@ -2,39 +2,76 @@
|
|
|
<div class="consump-layout">
|
|
|
<div class="c-header">
|
|
|
<ul class="tab-list">
|
|
|
- <li :class="{active:i===0}" v-for="(item,i) in tabList" :key="i">
|
|
|
+ <li @click="active = i" :class="{active:i===active}" v-for="(item,i) in tabList" :key="i">
|
|
|
{{item.name}}
|
|
|
</li>
|
|
|
</ul>
|
|
|
- <div class="tab-select">
|
|
|
+ <div class="tab-select" ref="invoiceMenu" @click="tabActive=!tabActive" :class="{'tab-active':tabActive}">
|
|
|
全部
|
|
|
<ul>
|
|
|
<li>全部</li>
|
|
|
- <li>子选项</li>
|
|
|
+ <li v-for="(item,i) in cameraList" :key="i">{{item.name}}</li>
|
|
|
</ul>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <tableList :header='capacity' :data='data' class="table-list" >
|
|
|
+ <div class="invoices" v-if="active===2">
|
|
|
+ <span>设备</span>
|
|
|
+ <div class="tab-select" ref="deviceMenu" @click="deviceActive=!deviceActive" :class="{'tab-active':deviceActive}">
|
|
|
+ 全部
|
|
|
+ <ul>
|
|
|
+ <li>全部</li>
|
|
|
+ <li v-for="(item,i) in invoicedevice" @click="selectInId(item)" :key="i" >{{item.childName}}</li>
|
|
|
+ </ul>
|
|
|
+ </div>
|
|
|
+ <span>可开票额度(元){{max}}</span>
|
|
|
+ <div class="btn parmary">开票</div>
|
|
|
+ </div>
|
|
|
+ <tableList :header='tabHeader' :data='data' class="table-list" >
|
|
|
<div slot-scope="{data}" slot="header">
|
|
|
{{data.name}}
|
|
|
</div>
|
|
|
- <div slot-scope="{data}" slot="item">
|
|
|
- {{data}}
|
|
|
+ <div slot-scope="{data,canclick,item}" slot="item">
|
|
|
+ <span class="edit" v-if="canclick" @click="showDetail(item)">{{data}}</span>
|
|
|
+ <span v-else>{{data}}</span>
|
|
|
</div>
|
|
|
</tableList>
|
|
|
<div class="paging" v-if="total">
|
|
|
<vcenter>
|
|
|
- <Paging @clickHandle="pageChange" :current="currentPage" :total="total" :equable="pageSize" />
|
|
|
+ <Paging @clickHandle="pageChange" :current="currentPage" :total="total" :equable="pageSize" />
|
|
|
</vcenter>
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import { mapState } from 'vuex'
|
|
|
+
|
|
|
import tableList from '@/components/table'
|
|
|
-import {capacity} from './iconsumption'
|
|
|
-import Paging from '@/components/Paging'
|
|
|
+import {capacity, recharge, invoice} from './iconsumption'
|
|
|
+import Paging from '@/components/tablePaging'
|
|
|
import vcenter from '@/components/vcenter'
|
|
|
+let PAYSSTR = {
|
|
|
+ 0: '微信',
|
|
|
+ 1: '支付宝',
|
|
|
+ 2: 'paypal'
|
|
|
+}
|
|
|
+
|
|
|
+let methodStr = {
|
|
|
+ 0: 'getConsumpList',
|
|
|
+ 1: 'getChargeList',
|
|
|
+ 2: 'getInvoiceList'
|
|
|
+}
|
|
|
+let rechargeType = {
|
|
|
+ 0: '系统赠送',
|
|
|
+ '-1': '支出',
|
|
|
+ 1: '充值',
|
|
|
+ 2: '系统退充值'
|
|
|
+}
|
|
|
+
|
|
|
+let invoceStatusType = {
|
|
|
+ 0: '未开票',
|
|
|
+ 1: '已开票'
|
|
|
+}
|
|
|
|
|
|
export default {
|
|
|
components: {
|
|
@@ -52,190 +89,300 @@ export default {
|
|
|
name: '增值发票'
|
|
|
}
|
|
|
]
|
|
|
- let data = [{
|
|
|
- orderSn: 'KR180928ac',
|
|
|
- channel: '官方预售活动赠送',
|
|
|
- size: '100G',
|
|
|
- paytype: '支付宝',
|
|
|
- bill: '9800元',
|
|
|
- validity: '终生有效',
|
|
|
- status: '使用中',
|
|
|
- date: '2018-09-28 16:14:23'
|
|
|
- }, {
|
|
|
- orderSn: 'KR180928ac',
|
|
|
- channel: '官方预售活动赠送',
|
|
|
- size: '100G',
|
|
|
- paytype: '支付宝',
|
|
|
- bill: '9800元',
|
|
|
- validity: '终生有效',
|
|
|
- status: '使用中',
|
|
|
- date: '2018-09-28 16:14:23'
|
|
|
- }, {
|
|
|
- orderSn: 'KR180928ac',
|
|
|
- channel: '官方预售活动赠送',
|
|
|
- size: '100G',
|
|
|
- paytype: '支付宝',
|
|
|
- bill: '9800元',
|
|
|
- validity: '终生有效',
|
|
|
- status: '使用中',
|
|
|
- date: '2018-09-28 16:14:23'
|
|
|
- }, {
|
|
|
- orderSn: 'KR180928ac',
|
|
|
- channel: '官方预售活动赠送',
|
|
|
- size: '100G',
|
|
|
- paytype: '支付宝',
|
|
|
- bill: '9800元',
|
|
|
- validity: '终生有效',
|
|
|
- status: '使用中',
|
|
|
- date: '2018-09-28 16:14:23'
|
|
|
- }, {
|
|
|
- orderSn: 'KR180928ac',
|
|
|
- channel: '官方预售活动赠送',
|
|
|
- size: '100G',
|
|
|
- paytype: '支付宝',
|
|
|
- bill: '9800元',
|
|
|
- validity: '终生有效',
|
|
|
- status: '使用中',
|
|
|
- date: '2018-09-28 16:14:23'
|
|
|
- }, {
|
|
|
- orderSn: 'KR180928ac',
|
|
|
- channel: '官方预售活动赠送',
|
|
|
- size: '100G',
|
|
|
- paytype: '支付宝',
|
|
|
- bill: '9800元',
|
|
|
- validity: '终生有效',
|
|
|
- status: '使用中',
|
|
|
- date: '2018-09-28 16:14:23'
|
|
|
- }, {
|
|
|
- orderSn: 'KR180928ac',
|
|
|
- channel: '官方预售活动赠送',
|
|
|
- size: '100G',
|
|
|
- paytype: '支付宝',
|
|
|
- bill: '9800元',
|
|
|
- validity: '终生有效',
|
|
|
- status: '使用中',
|
|
|
- date: '2018-09-28 16:14:23'
|
|
|
- } ]
|
|
|
|
|
|
+ let cameraList = [
|
|
|
+ {
|
|
|
+ name: '二目充值',
|
|
|
+ id: 0
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '八目扩容',
|
|
|
+ id: 4
|
|
|
+ }
|
|
|
+ ]
|
|
|
return {
|
|
|
- data,
|
|
|
+ tabHeader: capacity,
|
|
|
+ data: [],
|
|
|
+ cameraList,
|
|
|
tabList,
|
|
|
- capacity,
|
|
|
- total: 10,
|
|
|
+ active: 0,
|
|
|
+ recharge,
|
|
|
+ total: 30,
|
|
|
pageSize: 10,
|
|
|
- currentPage: 1
|
|
|
+ currentPage: 1,
|
|
|
+ searchKey: '',
|
|
|
+ tabActive: false,
|
|
|
+ deviceActive: false,
|
|
|
+ max: 0,
|
|
|
+ activeId: ''
|
|
|
+ }
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ ...mapState({
|
|
|
+ token: state => state.user.token,
|
|
|
+ myexpansion: state => {
|
|
|
+ let type = Object.prototype.toString.call(state.user.myexpansion)
|
|
|
+ if (type === '[object Object]') {
|
|
|
+ return state.user.myexpansion
|
|
|
+ }
|
|
|
+ let condition = state.user.myexpansion && state.user.myexpansion !== 'null' && type !== '[object Array]'
|
|
|
+ return (condition ? JSON.parse(state.user.myexpansion) : {})
|
|
|
+ },
|
|
|
+ mycharge: state => {
|
|
|
+ let type = Object.prototype.toString.call(state.user.mycharge)
|
|
|
+ if (type === '[object Object]') {
|
|
|
+ return state.user.mycharge
|
|
|
+ }
|
|
|
+ let condition = state.user.mycharge && state.user.mycharge !== 'null' && type !== '[object Array]'
|
|
|
+ return (condition ? JSON.parse(state.user.mycharge) : {})
|
|
|
+ },
|
|
|
+ myinvoicelist: state => {
|
|
|
+ let type = Object.prototype.toString.call(state.user.myinvoicelist)
|
|
|
+ if (type === '[object Object]') {
|
|
|
+ return state.user.myinvoicelist
|
|
|
+ }
|
|
|
+ let condition = state.user.myinvoicelist && state.user.myinvoicelist !== 'null' && type !== '[object Array]'
|
|
|
+ return (condition ? JSON.parse(state.user.myinvoicelist) : {})
|
|
|
+ },
|
|
|
+ invoicedevice: state => {
|
|
|
+ let type = Object.prototype.toString.call(state.user.invoicedevice)
|
|
|
+ if (type === '[object Object]') {
|
|
|
+ return state.user.invoicedevice
|
|
|
+ }
|
|
|
+ let condition = state.user.invoicedevice && state.user.invoicedevice !== 'null'
|
|
|
+ return (condition ? state.user.invoicedevice : [])
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ currentPage (newVal) {
|
|
|
+ this.getList()
|
|
|
+ },
|
|
|
+ activeId (newVal) {
|
|
|
+ this.getInvoiceMax()
|
|
|
+ if (this.active === 2) {
|
|
|
+ this.getList()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ active (newVal) {
|
|
|
+ switch (newVal) {
|
|
|
+ case 1:
|
|
|
+ this.tabHeader = recharge
|
|
|
+ break
|
|
|
+ case 2:
|
|
|
+ this.getAllDevice()
|
|
|
+ this.tabHeader = invoice
|
|
|
+ break
|
|
|
+ default:
|
|
|
+ this.tabHeader = capacity
|
|
|
+ break
|
|
|
+ }
|
|
|
+ this.currentPage === 1 ? this.getList() : this.currentPage = 1
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
pageChange (data) {
|
|
|
this.currentPage = data
|
|
|
+ },
|
|
|
+ selectInId (item) {
|
|
|
+ this.activeId = item.id
|
|
|
+ },
|
|
|
+ showDetail (item) {
|
|
|
+ this.$toast.showInvoice(item)
|
|
|
+ },
|
|
|
+ getList () {
|
|
|
+ let str = methodStr[this.active]
|
|
|
+ this[str]()
|
|
|
+ },
|
|
|
+ async getAllDevice (searchKey = '') {
|
|
|
+ let params = {
|
|
|
+ cameraType: ''
|
|
|
+ }
|
|
|
+ await this.$store.dispatch('getInvoiceDevice', params)
|
|
|
+ },
|
|
|
+ async getConsumpList (searchKey = '') {
|
|
|
+ let params = {
|
|
|
+ cameraId: searchKey,
|
|
|
+ pageNum: searchKey ? 1 : this.currentPage,
|
|
|
+ pageSize: this.pageSize
|
|
|
+ }
|
|
|
+ await this.$store.dispatch('getUserExpansion', params)
|
|
|
+ this.pageSize = this.myexpansion.pageSize
|
|
|
+ this.total = this.myexpansion.total || 0
|
|
|
+ this.data = this.myexpansion.list
|
|
|
+ this.data.forEach(item => {
|
|
|
+ item['unitSize'] = item['unitSize'] + item['unit']
|
|
|
+ item['channel'] = '扩充容量购买'
|
|
|
+ item['payType'] = PAYSSTR[item['payType']]
|
|
|
+ })
|
|
|
+ },
|
|
|
+ async getInvoiceMax () {
|
|
|
+ let res = await this.$http({
|
|
|
+ method: 'post',
|
|
|
+ data: {
|
|
|
+ cameraId: this.activeId
|
|
|
+ },
|
|
|
+ headers: {
|
|
|
+ token: this.token
|
|
|
+ },
|
|
|
+ url: '/user/invoice/max'
|
|
|
+ })
|
|
|
+
|
|
|
+ let data = res.data
|
|
|
+ if (data.code !== 0) return
|
|
|
+ this.max = data.data.maxInvoice
|
|
|
+ },
|
|
|
+ async getChargeList (searchKey = '') {
|
|
|
+ let params = {
|
|
|
+ cameraId: searchKey,
|
|
|
+ pageNum: searchKey ? 1 : this.currentPage,
|
|
|
+ pageSize: this.pageSize
|
|
|
+ }
|
|
|
+ await this.$store.dispatch('getChargeList', params)
|
|
|
+ this.pageSize = this.mycharge.pageSize
|
|
|
+ this.total = this.mycharge.total || 0
|
|
|
+ this.data = this.mycharge.list
|
|
|
+ this.data.forEach(item => {
|
|
|
+ item['status'] = rechargeType[item['status']]
|
|
|
+ })
|
|
|
+ },
|
|
|
+ async getInvoiceList () {
|
|
|
+ let params = {
|
|
|
+ cameraId: this.activeId,
|
|
|
+ pageNum: this.currentPage,
|
|
|
+ pageSize: this.pageSize
|
|
|
+ }
|
|
|
+ await this.$store.dispatch('getInvoiceList', params)
|
|
|
+ this.pageSize = this.myinvoicelist.pageSize
|
|
|
+ this.total = this.myinvoicelist.total || 0
|
|
|
+ this.data = this.myinvoicelist.list
|
|
|
+ this.data.forEach(item => {
|
|
|
+ item['detail'] = '详细'
|
|
|
+ item['finish'] = invoceStatusType[item['finish']]
|
|
|
+ })
|
|
|
}
|
|
|
+ },
|
|
|
+ mounted () {
|
|
|
+ this.getList()
|
|
|
+ document.addEventListener('click', (e) => {
|
|
|
+ if (this.$refs.invoiceMenu) {
|
|
|
+ if (!this.$refs.invoiceMenu.contains(e.target)) {
|
|
|
+ this.tabActive = false
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (this.$refs.deviceMenu) {
|
|
|
+ if (!this.$refs.deviceMenu.contains(e.target)) {
|
|
|
+ this.deviceActive = false
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
$theme-color: #1fe4dc;
|
|
|
+$font-color: #2d2d2d;
|
|
|
+$border-color: #d9d9d9;
|
|
|
+.btn {
|
|
|
+ text-align: center;
|
|
|
+ cursor: pointer;
|
|
|
+ }
|
|
|
+ .parmary {
|
|
|
+ background-color: $theme-color;
|
|
|
+ width: 99px;
|
|
|
+ height: 36px;
|
|
|
+ line-height: 36px;
|
|
|
+ }
|
|
|
.consump-layout{
|
|
|
margin: 30px 0 30px 40px;
|
|
|
- width: 90%;
|
|
|
+ padding: 38px 60px 20px 45px;
|
|
|
+ width: 1024px;
|
|
|
+ border: 1px solid $border-color;
|
|
|
.c-header{
|
|
|
.tab-list{
|
|
|
display: inline-block;
|
|
|
li{
|
|
|
display: inline-block;
|
|
|
margin-right: 40px;
|
|
|
+ line-height: 1.5;
|
|
|
cursor: pointer;
|
|
|
+ font-size: 14px;
|
|
|
}
|
|
|
.active{
|
|
|
color: $theme-color;
|
|
|
- border-bottom: 2px solid $theme-color;
|
|
|
- font-weight: bold;
|
|
|
+ border-bottom: 1px solid $theme-color;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ }
|
|
|
+ .invoices{
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ margin-top: 38px;
|
|
|
+ span{
|
|
|
+ font-size: 14px;
|
|
|
+ margin-right: 20px;
|
|
|
+ }
|
|
|
.tab-select{
|
|
|
+ margin-right: 20px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .tab-select{
|
|
|
float: right;
|
|
|
position: relative;
|
|
|
width: 200px;
|
|
|
+ height: 28px;
|
|
|
+ line-height: 28px;
|
|
|
padding-left: 10px;
|
|
|
- border: 1px solid #ccc;
|
|
|
- border-radius: 5px;
|
|
|
+ border: 1px solid $border-color;
|
|
|
+ font-size: 14px;
|
|
|
+ color: #969696;
|
|
|
+ cursor: pointer;
|
|
|
+ &::after{
|
|
|
+ position: absolute;
|
|
|
+ right: 10px;
|
|
|
+ top: 50%;
|
|
|
+ transform: translateY(calc(-50% + 3px));
|
|
|
+ content: '';
|
|
|
+ width: 0;
|
|
|
+ height: 0;
|
|
|
+ border: 5px solid;
|
|
|
+ display: inline-block;
|
|
|
+ border-color: #828282 transparent transparent;
|
|
|
+ }
|
|
|
ul{
|
|
|
position: absolute;
|
|
|
- // max-height: 0;
|
|
|
+ max-height: 0;
|
|
|
left: 0;
|
|
|
- top: 24px;
|
|
|
+ top: 34px;
|
|
|
padding-left: 10px;
|
|
|
background: #fff;
|
|
|
overflow: hidden;
|
|
|
width: 100%;
|
|
|
- box-shadow: 0 0 10px rgba($color: #000000, $alpha: 0.5);
|
|
|
+ transition:all 0.3s ease;
|
|
|
+ box-shadow: 0 0 10px rgba($color: #000000, $alpha: 0.4);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .tab-active{
|
|
|
+ ul{
|
|
|
+ max-height: 220px;
|
|
|
+ overflow: auto;
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
.table-list{
|
|
|
- margin-top: 40px;
|
|
|
- }
|
|
|
- .paging {
|
|
|
- // border-left: #e5e5e5 1px solid;
|
|
|
- height: 100%;
|
|
|
- margin-bottom: 40px;
|
|
|
- & /deep/ .layout {
|
|
|
- text-align: center;
|
|
|
- margin-top: 10px;
|
|
|
+ margin-top: 38px;
|
|
|
+ div{
|
|
|
+ width: 100%;
|
|
|
}
|
|
|
- & /deep/ .layout a:not(:last-child) {
|
|
|
- margin: 10px 8px;
|
|
|
- font-size: 16px;
|
|
|
- display: inline-block;
|
|
|
- font-weight: 500;
|
|
|
+ .edit{
|
|
|
+ color: $theme-color;
|
|
|
cursor: pointer;
|
|
|
- user-select: none;
|
|
|
- color: #999;
|
|
|
- position: relative;
|
|
|
- transition: color 0.3s;
|
|
|
- }
|
|
|
- & /deep/ .layout a:last-child {
|
|
|
- position: relative;
|
|
|
- top: -5px;
|
|
|
- display: -ms-inline-flexbox;
|
|
|
- display: inline-flex;
|
|
|
- -ms-flex-align: center;
|
|
|
- align-items: center;
|
|
|
- height: 22px;
|
|
|
- padding: 0 9.6px;
|
|
|
- padding: 0 0.6rem;
|
|
|
- }
|
|
|
- & /deep/ .layout a:last-child::before,
|
|
|
- & /deep/ .layout a:last-child::after {
|
|
|
- content: "";
|
|
|
- display: inline-block;
|
|
|
- will-change: transform;
|
|
|
- transition: transform 0.3s;
|
|
|
- }
|
|
|
-
|
|
|
- & /deep/ .layout a:not(:last-child).active::after,
|
|
|
- & /deep/ .layout a:not(:last-child).active,
|
|
|
- & /deep/ .layout a:not(:last-child):hover,
|
|
|
- & /deep/ .layout a:not(:last-child):hover::after {
|
|
|
- color: #111111;
|
|
|
- transform: scaleX(1);
|
|
|
- }
|
|
|
-
|
|
|
- & /deep/ .layout a:not(:last-child)::after {
|
|
|
- content: "";
|
|
|
- height: 3px;
|
|
|
- width: 140%;
|
|
|
- background-color: #111;
|
|
|
- display: block;
|
|
|
- margin-left: -20%;
|
|
|
- margin-top: 3px;
|
|
|
- transform-origin: 50% 50%;
|
|
|
- transform: scaleX(0);
|
|
|
- will-change: transform;
|
|
|
- transition: transform 0.3s;
|
|
|
}
|
|
|
}
|
|
|
+ .paging {
|
|
|
+ height: 100%;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
</style>
|