AccountGroupList.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. <template><page-meta :root-font-size="fontSize+'px'"></page-meta>
  2. <seller-base :show="false">
  3. <view class="div distributor-account_group-list">
  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" v-if="account_group_list.length>0">
  14. <view class="div" v-for="item in account_group_list" :key="item.sellergroup_id">
  15. <view class="div container mt-5">
  16. <view class="div accountgroup-info">
  17. <view class='sellergroup_name'>
  18. <label class="subtitle">
  19. {{ item.sellergroup_name }}
  20. </label>
  21. </view>
  22. <view class="div button-wrapper">
  23. <view class="div edit-wrapper" @click="onEdit(item.sellergroup_id)">
  24. <view class="div common-btn btn-2 mr-5">编辑</view>
  25. </view>
  26. <view class="div edit-wrapper delete-wrapper" @click="onDelete(item.sellergroup_id)">
  27. <view class="div common-btn btn-1">删除</view>
  28. </view>
  29. </view>
  30. </view>
  31. </view>
  32. </view>
  33. </view>
  34. <view class="div" v-else>
  35. <empty-record></empty-record>
  36. </view>
  37. <view class='common-add-btn-wrapper'><view class="div common-btn common-add-btn" @click="goAdd">新增</view></view>
  38. </view>
  39. </seller-base>
  40. </template>
  41. <script>
  42. import {getFontSize} from '@/util/common'
  43. import TitleHeader from '../../TitleHeader'
  44. import { urlencode } from '@/util/common'
  45. import SellerBase from '../SellerBase'
  46. import EmptyRecord from '../../EmptyRecord'
  47. import { getAccountGroupList, delAccountGroup } from '../../../api/sellerAccountGroup'
  48. export default {
  49. components:{
  50. TitleHeader,
  51. SellerBase,
  52. EmptyRecord
  53. },
  54. name: 'SellerAccountGroup',
  55. computed:{
  56. fontSize(){
  57. return getFontSize()
  58. },
  59. },
  60. data(){
  61. return {
  62. navHeight: 0,
  63. account_group_list: []
  64. }
  65. },
  66. onShow: function () {
  67. this.getAccountGroupList()
  68. },
  69. mounted(){
  70. // #ifdef MP-WEIXIN
  71. this.navHeight = uni.getMenuButtonBoundingClientRect().height
  72. // #endif
  73. },
  74. methods: {
  75. goBack () {
  76. uni.navigateBack({delta:1})
  77. },
  78. goAdd () {
  79. uni.navigateTo({url:'/pages/seller/accountgroup/AccountGroupForm'+'?'+urlencode({ action: 'add' })})
  80. },
  81. onEdit (sellergroup_id) {
  82. uni.navigateTo({url:'/pages/seller/accountgroup/AccountGroupForm'+'?'+urlencode({ group_id: sellergroup_id })})
  83. },
  84. onDelete (sellergroup_id) {
  85. uni.showLoading({ title: '加载中' })
  86. delAccountGroup(sellergroup_id).then(
  87. (response) => {
  88. this.getAccountGroupList()
  89. uni.hideLoading()
  90. }, (error) => {
  91. uni.hideLoading()
  92. uni.showToast({icon:'none',title: error.message})
  93. })
  94. },
  95. getAccountGroupList () {
  96. getAccountGroupList().then(res => {
  97. this.account_group_list = res.result.seller_group_list
  98. }).catch(function (error) {
  99. uni.showToast({icon:'none',title: error.message})
  100. })
  101. }
  102. }
  103. }
  104. </script>
  105. <style lang="scss" scoped>
  106. .distributor-account_group-list {
  107. .common-header{
  108. .btn{background: #000;color: #fff;box-shadow: 0px 2px 4px #d2d2d2;}
  109. }
  110. .container {
  111. display: flex;
  112. flex-direction: column;
  113. justify-content: flex-start;
  114. align-items: stretch;
  115. background-color: #fff;
  116. border-radius: .5rem;
  117. }
  118. .btn-1{background-color: #FB2630;}
  119. .btn-2{background-color: $primaryColor;}
  120. .accountgroup-info {
  121. padding: .5rem 1rem 1.5rem;
  122. box-sizing: border-box;
  123. }
  124. .sellergroup_name {
  125. text-align: center;
  126. padding:2rem 0 1rem;
  127. }
  128. .button-wrapper {
  129. display: flex;
  130. justify-content: center;
  131. .common-btn{
  132. color: #fff;
  133. padding:.5rem 3rem ;
  134. }
  135. }
  136. .edit-wrapper {
  137. display: flex;
  138. flex-direction: row;
  139. justify-content: flex-start;
  140. align-items: center;
  141. }
  142. .delete-wrapper {
  143. margin-right: 0.5rem;
  144. }
  145. .subtitle {
  146. font-size:1rem;
  147. color: #333;
  148. font-weight: bold;
  149. }
  150. }
  151. </style>