list.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. <template>
  2. <div class="app-content">
  3. <div class="list-wrap staff-list">
  4. <block v-if="!$util.isEmpty(list.data)">
  5. <div class="list" v-for="(item, index) in list.data" :key="index">
  6. <div class="list-avatar">
  7. <app-avatar-module :src="item.avatar" :width="90" />
  8. </div>
  9. <div class="list-det">
  10. <div class="list-det-left">
  11. <div>
  12. <span class="staff-name">{{ item.shopName }}</span>
  13. <span>{{ item.telephone }}</span>
  14. </div>
  15. <div class="flex-center">
  16. <div class="status-list">
  17. <span class v-if="item.gatheringCode" @click="downQrCodeFn(item, index)">收款码下载</span>
  18. <span v-else></span>
  19. </div>
  20. <div class="status-list">
  21. <span class v-if="item.gatheringCode" @click="downMemberCodeFn(item, index)">会员码下载</span>
  22. <span v-else></span>
  23. </div>
  24. </div>
  25. </div>
  26. <div class="list-det-right">
  27. <div @click="toModiyFn(item)">
  28. <i class="iconfont iconbianji"></i>
  29. </div>
  30. <!-- 删除 -->
  31. <div @click="delModalFn(item)">
  32. <i class="iconfont iconshanchu1"></i>
  33. </div>
  34. </div>
  35. </div>
  36. </div>
  37. </block>
  38. <block v-else>
  39. <app-wrapper-empty title="暂无数据" :is-empty="$util.isEmpty(list.data)" />
  40. </block>
  41. </div>
  42. <!-- 按钮 -->
  43. <div class="app-footer">
  44. <!-- <div class="admin-button-com middle blue" @click="pageTo('/admin/shop/add')">添加门店</div> -->
  45. <div class="admin-button-com middle blue">添加门店</div>
  46. </div>
  47. <!-- 删除弹窗 -->
  48. <modal-module :show="delModal" @cancel="modalCancel" @click="delModalClick" content="是否要删除该门店" color="#333" :size="32" padding="30rpx 30rpx"></modal-module>
  49. </div>
  50. </template>
  51. <script>
  52. import AppAvatarModule from '@/components/module/app-avatar'
  53. import AppWrapperEmpty from '@/components/app-wrapper-empty'
  54. import ModalModule from '@/components/plugin/modal'
  55. import { list } from '@/mixins'
  56. // api
  57. import { getList, downQrCode, downMemberCode, delShop } from '@/api/shop'
  58. export default {
  59. name: 'shop-list',
  60. components: {
  61. AppAvatarModule,
  62. AppWrapperEmpty,
  63. ModalModule
  64. },
  65. mixins: [list],
  66. data() {
  67. return {
  68. // 删除弹窗操作
  69. delModal: false,
  70. delModalText: '确定删除该员工吗?',
  71. operateData: {}
  72. }
  73. },
  74. onPullDownRefresh() {
  75. this.resetList()
  76. this._list().then(res => {
  77. uni.stopPullDownRefresh()
  78. })
  79. },
  80. onReachBottom() {
  81. if (!this.list.finished) {
  82. this._list().then(res => {
  83. uni.stopPullDownRefresh()
  84. })
  85. } else {
  86. uni.stopPullDownRefresh()
  87. }
  88. },
  89. onLoad: function() {
  90. // this.init()
  91. },
  92. methods: {
  93. async init() {
  94. this._list()
  95. },
  96. _list() {
  97. return getList().then(res => {
  98. this.completes(res)
  99. })
  100. },
  101. toModiyFn(item) {
  102. uni.setStorageSync('modifyShopB', item)
  103. this.pageTo({
  104. url: '/admin/shop/add',
  105. query: {
  106. id: item.id
  107. }
  108. })
  109. },
  110. // 收款码
  111. downQrCodeFn(item, index) {
  112. downQrCode({ id: item.id })
  113. uni.previewImage({
  114. urls: [this.$constant.formal + item.gatheringCode]
  115. })
  116. },
  117. viewQrCodeFn(item) {
  118. uni.previewImage({
  119. urls: item.gatheringCode
  120. })
  121. },
  122. // 会员码
  123. downMemberCodeFn(item, index) {
  124. downMemberCode({ id: item.id })
  125. uni.previewImage({
  126. urls: [this.$constant.formal + item.applyMemberCode]
  127. })
  128. },
  129. viewMemberCodeFn(item) {
  130. uni.previewImage({
  131. urls: item.applyMemberCode
  132. })
  133. },
  134. // 关闭弹窗
  135. modalCancel() {
  136. this.delModal = false
  137. this.roleModal = false
  138. },
  139. // 删除弹窗
  140. delModalFn(item) {
  141. this.$msg('即将开通...')
  142. return false
  143. this.delModalText = this.tabIndex == 0 ? '确定删除该吗?' : '确定删除该角色吗?'
  144. this.operateData = item
  145. this.delModal = true
  146. },
  147. delModalClick(e) {
  148. let index = e.index
  149. if (index === 0) {
  150. this.modalCancel()
  151. } else {
  152. delShop({ id: this.operateData.id }).then(res => {
  153. this.modalCancel()
  154. this.$msg('删除成功!')
  155. setTimeout(() => {
  156. this.resetList()
  157. this._list()
  158. }, 1000)
  159. })
  160. }
  161. }
  162. }
  163. }
  164. </script>
  165. <style lang="scss" scoped>
  166. .app-content {
  167. min-height: calc(100vh - 100px);
  168. padding-bottom: 100px;
  169. }
  170. // 列表公共
  171. .list-wrap {
  172. background-color: #fff;
  173. .list {
  174. @include disFlex(center, flex-start);
  175. margin: 0 30px;
  176. padding: 30px 0;
  177. border-bottom: 2px solid $borderColor;
  178. }
  179. }
  180. // 员工列表
  181. .staff-list {
  182. .list-det {
  183. width: calc(100% - 110px);
  184. color: $fontColor3;
  185. margin-left: 20px;
  186. @include disFlex(center, space-between);
  187. .list-det-left {
  188. .staff-name {
  189. color: #333;
  190. font-size: 30px;
  191. font-weight: 600;
  192. margin-right: 20px;
  193. }
  194. .flex-center {
  195. margin-top: 18px;
  196. }
  197. .status-list {
  198. margin-left: 60px;
  199. color: $mainColor;
  200. &:first-child {
  201. margin-left: 0;
  202. }
  203. .iconfont {
  204. // color: $fontColor3;
  205. font-size: 24px;
  206. margin-right: 10px;
  207. }
  208. }
  209. }
  210. .list-det-right {
  211. @include disFlex(center, flex-start);
  212. & > div {
  213. margin-left: 50px;
  214. &:first-child {
  215. margin-left: 0;
  216. }
  217. }
  218. .iconfont {
  219. font-size: 36px;
  220. color: $fontColor3;
  221. }
  222. }
  223. }
  224. }
  225. // 按钮
  226. .app-footer {
  227. justify-content: flex-end;
  228. .admin-button-com {
  229. width: 160px;
  230. margin-right: 30px;
  231. }
  232. }
  233. </style>