AccountList.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. <template><page-meta :root-font-size="fontSize+'px'"></page-meta>
  2. <seller-base :show="false">
  3. <view class="div container">
  4. <view class="div common-header-wrap">
  5. <view :style="'height:'+navHeight+'px'"></view>
  6. <view class="common-header-holder"></view>
  7. <view class="common-header-fixed">
  8. <title-header />
  9. <uni-nav-bar title="子账户管理" class="common-header" left-icon="back" @clickLeft="goBack()">
  10. </uni-nav-bar>
  11. </view>
  12. </view>
  13. <view class='div pb-30'>
  14. <view class="div main-content" v-for="item in sellerList" v-bind:key="item.seller_id" >
  15. <view class="div container mt-5">
  16. <view class="div account-info">
  17. <view class="lastlogin" v-if="item.last_logintime">
  18. <view>上次登录</view>
  19. <text>{{item.last_logintime}}</text>
  20. </view>
  21. <view class='seller_name'>
  22. <label class="subtitle">
  23. {{ item.seller_name }}
  24. </label>
  25. </view>
  26. <view class="div button-wrapper">
  27. <view class="div edit-wrapper" @click="onEdit(item.seller_id)">
  28. <view class="div common-btn btn-2 mr-5">编辑</view>
  29. </view>
  30. <view class="div edit-wrapper delete-wrapper" @click="onDelete(item.seller_id)">
  31. <view class="div common-btn btn-1">删除</view>
  32. </view>
  33. </view>
  34. </view>
  35. </view>
  36. </view>
  37. <empty-record v-if="sellerList && !sellerList.length"></empty-record>
  38. </view>
  39. <view class='common-add-btn-wrapper'><view class="div common-btn common-add-btn" @click="goAdd">新增</view></view>
  40. </view>
  41. <uni-popup background-color="#fff" ref="confirm" type="dialog">
  42. <uni-popup-dialog :mode="dialog.mode" :title="dialog.title" :content="dialog.content" :placeholder="dialog.content" @confirm="confirmDialog" @close="closeDialog"></uni-popup-dialog>
  43. </uni-popup>
  44. </seller-base>
  45. </template>
  46. <script>
  47. import {getFontSize} from '@/util/common'
  48. import TitleHeader from '../../TitleHeader'
  49. import { urlencode } from '@/util/common'
  50. import SellerBase from '../SellerBase'
  51. import EmptyRecord from '../../EmptyRecord'
  52. import { getSellerAccountList,delSellerAccount } from '../../../api/sellerAccount'
  53. import flexLine from '../../flexLine'
  54. export default {
  55. name: 'AccountList',
  56. components:{
  57. TitleHeader,
  58. SellerBase,
  59. flexLine,
  60. EmptyRecord
  61. },
  62. computed:{
  63. fontSize(){
  64. return getFontSize()
  65. },
  66. },
  67. data(){
  68. return {
  69. dialog:{},
  70. navHeight: 0,
  71. sellerList: false // 用户列表
  72. }
  73. },
  74. onShow: function () {
  75. this.getAccountList()
  76. },
  77. mounted(){
  78. // #ifdef MP-WEIXIN
  79. this.navHeight = uni.getMenuButtonBoundingClientRect().height
  80. // #endif
  81. },
  82. methods:{
  83. goBack(){uni.navigateBack({delta:1})},
  84. getAccountList () {
  85. uni.showLoading({ title: '加载中' })
  86. getSellerAccountList().then(res => {
  87. uni.hideLoading()
  88. this.sellerList = res.result.seller_list
  89. }).catch(function (error) {
  90. uni.hideLoading()
  91. uni.showToast({icon:'none',title: error.message})
  92. })
  93. },
  94. confirmDialog(value){
  95. delSellerAccount(this.dialog.data).then(
  96. (response) => {
  97. uni.navigateTo({url:'/pages/seller/account/AccountList'})
  98. }, (error) => {
  99. uni.showToast({icon:'none',title: error.message})
  100. })
  101. },
  102. onEdit (sellerId) {
  103. uni.navigateTo({url:'/pages/seller/account/AccountForm'+'?'+urlencode({ seller_id: sellerId })})
  104. },
  105. goAdd () {
  106. uni.navigateTo({url:'/pages/seller/account/AccountForm'+'?'+urlencode({ action: 'add' })})
  107. },
  108. onDelete (id) {
  109. this.dialog={content:'确定要取消该账号吗?',data:id}
  110. this.$refs.confirm.open()
  111. },
  112. }
  113. }
  114. </script>
  115. <style scoped lang="scss">
  116. .common-header{
  117. .btn{background: #000;color: #fff;box-shadow: 0px 2px 4px #d2d2d2;}
  118. }
  119. .main-content{background: #fff;padding:0 $pageSpace}
  120. .container{border-bottom: 1px dashed #eee;}
  121. .account-info {padding: .5rem 1rem 1.5rem;box-sizing: border-box;}
  122. .account-info .lastlogin view{font-size: .7rem;color: #333;}
  123. .account-info .lastlogin text{font-size: .7rem;color: #999;}
  124. .account-info .seller_name {text-align: center;padding: 2rem 0 1rem;}
  125. .account-info .seller_name .subtitle {font-size:1rem;color: #333;font-weight: bold;}
  126. .account-info .button-wrapper {flex: 1;display: flex;flex-direction: row;justify-content: center;align-items: center;}
  127. .account-info .button-wrapper .edit-wrapper{color: #fff;border-radius: 1.5rem;padding: .1rem .3rem;margin: 0 .2rem;background: $primaryColor;}
  128. .account-info .button-wrapper .edit-wrapper .common-btn{color: #fff;padding:.5rem 3rem ;}
  129. .account-info .button-wrapper .delete-wrapper{background: #FB2630;}
  130. </style>