user.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. <template>
  2. <view class="records">
  3. <view class="search-wrap">
  4. <view class="search-input-inner">
  5. <text class="search-input-icon iconfont iconsousuo" @click="search()"></text>
  6. <input class="search-input-text font-size-tag" maxlength="50" v-model="formData.verifier_name" placeholder="请输入核销人员名称" @confirm="search()" />
  7. </view>
  8. <view class="search-btn color-base-bg" @click="$util.redirectTo('/pages/verify/user_edit')">
  9. <text>+</text>
  10. <text>核销人员</text>
  11. </view>
  12. </view>
  13. <mescroll-uni class="list-wrap" @getData="getListData" top="160" ref="mescroll" :size="8">
  14. <block slot="list">
  15. <block v-if="recordsList.length > 0">
  16. <view class="list" v-for="(item, index) in recordsList" :key="index">
  17. <view class="title">
  18. <text class="time">核销人员:{{ item.verifier_name }}</text>
  19. <view>
  20. <text class="color-base-text" @click="edit_user(item.verifier_id)">编辑</text>
  21. <text class="margin-left color-base-text" @click="delete_user(index)">删除</text>
  22. </view>
  23. </view>
  24. <view class="other_info padding-top">
  25. 会员账号:
  26. <block v-if="item.member_id && item.username">{{ item.username }}</block>
  27. <block v-else-if="item.member_id && !item.username">{{ item.mobile }}</block>
  28. <block v-else>--</block>
  29. </view>
  30. <view class="other_info">创建时间:{{ $util.timeStampTurnTime(item.create_time) }}</view>
  31. </view>
  32. </block>
  33. <ns-empty v-else-if="isShow && recordsList.length == 0" text="暂无核销数据"></ns-empty>
  34. </block>
  35. </mescroll-uni>
  36. </view>
  37. </template>
  38. <script>
  39. export default {
  40. data() {
  41. return {
  42. isShow: false,
  43. formData: {
  44. verifier_name: ''
  45. },
  46. recordsList: []
  47. };
  48. },
  49. onShow() {
  50. if (!this.$util.checkToken('/pages/verify/user')) return;
  51. if (this.$refs.mescroll) this.$refs.mescroll.refresh();
  52. },
  53. methods: {
  54. edit_user(id) {
  55. this.$util.redirectTo('/pages/verify/user_edit', { verifier_id: id });
  56. },
  57. search() {
  58. this.$refs.mescroll.refresh();
  59. },
  60. //删除
  61. delete_user(index) {
  62. uni.showModal({
  63. title: '操作提示',
  64. content: '确定要删除此核销员吗?',
  65. success: res => {
  66. this.$api.sendRequest({
  67. url: '/shopapi/verify/deleteUser',
  68. data: { ids: this.recordsList[index].verifier_id },
  69. success: res => {
  70. if (res.code >= 0 && res.data) {
  71. this.recordsList.splice(index, 1);
  72. } else {
  73. this.$util.showToast({
  74. title: this.message
  75. });
  76. }
  77. }
  78. });
  79. }
  80. });
  81. },
  82. getListData(mescroll) {
  83. var data = {
  84. page_size: mescroll.size,
  85. page: mescroll.num
  86. };
  87. Object.assign(data, this.formData);
  88. this.$api.sendRequest({
  89. url: '/shopapi/verify/user',
  90. data: data,
  91. success: res => {
  92. let newArr = [];
  93. let msg = res.message;
  94. if (res.code == 0 && res.data) {
  95. newArr = res.data.list;
  96. } else {
  97. this.$util.showToast({
  98. title: msg
  99. });
  100. }
  101. mescroll.endSuccess(newArr.length);
  102. //设置列表数据
  103. if (mescroll.num == 1) this.recordsList = []; //如果是第一页需手动制空列表
  104. this.recordsList = this.recordsList.concat(newArr); //追加新数据
  105. if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
  106. this.isShow = true;
  107. }
  108. });
  109. }
  110. }
  111. };
  112. </script>
  113. <style lang="scss">
  114. page {
  115. overflow: hidden;
  116. }
  117. .search-wrap {
  118. display: flex;
  119. justify-content: space-between;
  120. padding: 30rpx 30rpx;
  121. background-color: #fff;
  122. .search-input-inner {
  123. display: flex;
  124. align-items: center;
  125. width: 460rpx;
  126. height: 70rpx;
  127. padding: 0 30rpx;
  128. background-color: $color-bg;
  129. border-radius: 100rpx;
  130. box-sizing: border-box;
  131. .search-input-icon {
  132. margin-right: 10rpx;
  133. color: $color-tip;
  134. }
  135. }
  136. .search-btn {
  137. display: flex;
  138. justify-content: center;
  139. align-items: center;
  140. width: 200rpx;
  141. height: 70rpx;
  142. color: #fff;
  143. border-radius: 100rpx;
  144. text {
  145. margin-right: 10rpx;
  146. }
  147. }
  148. }
  149. .list {
  150. background-color: #fff;
  151. margin: 0 $margin-both $margin-both;
  152. padding: 0 30rpx 20rpx;
  153. border-radius: $border-radius;
  154. .title {
  155. display: flex;
  156. align-items: center;
  157. padding: 20rpx 0;
  158. border-bottom: 1px solid $color-line;
  159. .time {
  160. flex: 1;
  161. overflow: hidden;
  162. text-overflow: ellipsis;
  163. white-space: nowrap;
  164. }
  165. .status {
  166. margin-left: 30rpx;
  167. }
  168. }
  169. .status {
  170. margin-left: 30rpx;
  171. }
  172. }
  173. .other_info {
  174. font-size: $font-size-tag;
  175. color: $color-tip;
  176. }
  177. </style>