index.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. <template>
  2. <view class="total-page page-box page-env-20 scroll_content task-bg">
  3. <Nav :title="'草稿箱'" :genre="1" :back="true" is_fixed></Nav>
  4. <view>
  5. <Search :placeholder="'客户姓名或电话'"></Search>
  6. </view>
  7. <EnScroll ref="scroll" :navHeight="0" is_tabHeight @onRefresh="onRefresh" @onScrollBottom="onScrollBottom">
  8. <view class="draft-item r-40 sys-background-fff" v-for="(item,index) in list">
  9. <view class="item-left">
  10. <view class="left-top left-item">
  11. <view class="top-name sys-weight-600 size-30 text-color-12">{{item.name}}</view>
  12. <view class="top-product sys-weight-400 size-24 text-color-009 r-10">{{item.product_name}}</view>
  13. </view>
  14. <view class="left-content left-item">
  15. <view class="sys-weight-400 size-24 text-color-12">身份证:</view>
  16. <view class="sys-weight-600 sys-size-28 text-color-12">{{item.id_number}}</view>
  17. </view>
  18. <view class="left-bottom left-item">
  19. <view class=" size-24 text-color-999">保存时间:</view>
  20. <view class=" size-24 text-color-999">{{item.created_at}}</view>
  21. </view>
  22. </view>
  23. <view class="item-right">
  24. <view class="but-item but-edit size-28 sys-weight-500 text-color-fff button-background sys-radius-100">编辑</view>
  25. <view class="but-item but-del size-28 sys-weight-500 text-color-666 " @click.stop="delDraft(item.id,index)">删除</view>
  26. </view>
  27. </view>
  28. <en-blank v-if="list.length<=0"></en-blank>
  29. </EnScroll>
  30. </view>
  31. </template>
  32. <script>
  33. import {getDraftList} from "@/api/task";
  34. import EnBlank from "@/components/en-utils/en-blank/en-blank.vue";
  35. export default {
  36. components: {EnBlank},
  37. data() {
  38. return {
  39. list: [],
  40. page: 1,
  41. total: null,
  42. isAjax: false,
  43. };
  44. },
  45. mounted(){
  46. uni.$on('setNewDraft',()=>{
  47. if(this.$refs.draftRef){
  48. this.startList()
  49. }
  50. })
  51. this.startList()
  52. },
  53. methods: {
  54. startList() {
  55. this.total = 999;
  56. this.list = [];
  57. this.page = 1;
  58. this.isAjax = false;
  59. this.getDraftList();
  60. },
  61. delDraft(draftId,index){
  62. uni.showModal({
  63. title: '警告',
  64. content: '是否删除当前草稿!',
  65. success: (res) =>{
  66. if (res.confirm) {
  67. delDraft({'draftId':draftId}).then((res)=>{
  68. this.$refs.draftRef.list.splice(index,1)
  69. })
  70. }
  71. }
  72. });
  73. },
  74. editDraft(id){
  75. // uni.navigateTo({
  76. // url: '/pages-task/add-client/new-add?draftId='+id
  77. // });
  78. },
  79. getDraftList(){
  80. if (this.isAjax || (this.total <= this.list.length)) {
  81. return;
  82. }
  83. this.isAjax = true;
  84. getDraftList({'page':this.page}).then((res)=>{
  85. if(res.code===1){
  86. this.list.push(...res.data.items)
  87. this.total = res.data.total
  88. this.isAjax = false
  89. ++this.page;
  90. }
  91. })
  92. },
  93. // 下拉刷新
  94. onRefresh() {
  95. // uni.showLoading({
  96. // title: '数据加载中'
  97. // })
  98. // setTimeout(() => {
  99. // uni.showToast({
  100. // title: '加载完成',
  101. // icon: 'none'
  102. // })
  103. // this.$refs.scroll.onEndPulling()
  104. // }, 1000)
  105. console.log("下拉刷新");
  106. this.startList()
  107. },
  108. // 滚动到底部
  109. onScrollBottom() {
  110. this.getDraftList();
  111. console.log("到底部了");
  112. },
  113. },
  114. }
  115. </script>
  116. <style lang="scss">
  117. .draft-item{
  118. margin: 20rpx 32rpx 0;
  119. padding: 25rpx 30rpx;
  120. display: flex;
  121. justify-content: space-between;
  122. .item-left{
  123. .left-item{
  124. display: flex;
  125. justify-content: left;
  126. align-items: center;
  127. }
  128. .left-top{
  129. height: 52rpx;
  130. .top-product{
  131. background-color: rgba(15, 177, 96, 0.1);
  132. padding: 9rpx 22rpx;
  133. margin-left: 20rpx;
  134. }
  135. }
  136. .left-content{
  137. margin-top: 24rpx;
  138. height: 40rpx;
  139. }
  140. .left-bottom{
  141. margin-top: 24rpx;
  142. height: 34rpx;
  143. }
  144. }
  145. .item-right{
  146. padding-top: 20rpx;
  147. .but-item{
  148. width: 172rpx;
  149. height: 70rpx;
  150. text-align: center;
  151. line-height: 70rpx;
  152. }
  153. .but-del{
  154. margin-top: 15rpx;
  155. box-sizing: border-box;
  156. border-radius: 99rpx 99rpx 99rpx 99rpx;
  157. border: 1rpx solid #666666;
  158. }
  159. }
  160. }
  161. </style>