list.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. <template>
  2. <view>
  3. <view class="scoped-list-pdf">
  4. <view v-if="customerList.length == 0" class="empty-wrap"><u-empty mode="list" text="暂无数据"></u-empty></view>
  5. <view v-for="(item, index) in customerList" class="slp-item" :key="index">
  6. <view class="slp-info" @click="pageTo(`/pages/user/contract/edit?id=${item.id}`)">
  7. <view class="p1">{{ item.contract_name }}</view>
  8. <view class="p2">合同金额:{{ item.contract_amount }}万元</view>
  9. <view class="p2">截至日期:{{ item.end_at }}</view>
  10. <view class="p2">创建时间:{{ item.create_at }}</view>
  11. </view>
  12. <u-image src="/static/icon_bg_pdf.png" @click="linkWebView(item)" mode="heightFix" height="100rpx" class="img"></u-image>
  13. <!-- <view @click="delHandle(item)" >删除</view> -->
  14. </view>
  15. </view>
  16. <view class="float-search2" @click="pageTo('/pages/user/contract/edit')"><u-icon name="plus" size="42" color="#fff"></u-icon></view>
  17. <view class="float-search" @click="searchPopupShow = true"><u-icon name="search" size="42" color="#fff"></u-icon></view>
  18. <u-popup v-model="searchPopupShow" mode="center" width="80%" height="340rpx" border-radius="20">
  19. <view class="bwin-popup">
  20. <view class="popup-header">合同搜索</view>
  21. <view class="popup-body">
  22. <u-input v-model="searchFormData.contract_name" border placeholder="请输入合同标题(支持模糊搜索)"></u-input>
  23. <!-- <u-divider marginTop="10" marginBottom="10">或</u-divider>
  24. <u-input v-model="searchFormData.phone" border placeholder="请输入手机号(可仅输入一部分)"></u-input> -->
  25. </view>
  26. <view class="popup-footer" style="position: absolute;">
  27. <u-button size="medium" @click="searchPopupShow = false">取消</u-button>
  28. <u-button size="medium" type="primary" @click="searchHandle()">搜索</u-button>
  29. </view>
  30. </view>
  31. </u-popup>
  32. <u-loadmore
  33. v-if="customerList.length > 0"
  34. marginTop="32"
  35. :line="true"
  36. :status="loadmore.status"
  37. :loading-text="loadmore.loadingText"
  38. :loadmore-text="loadmore.defaultText"
  39. :nomore-text="loadmore.nomoreText"
  40. />
  41. </view>
  42. </template>
  43. <script>
  44. var that;
  45. export default {
  46. data() {
  47. return {
  48. searchKeyword: null,
  49. searchPopupShow: false,
  50. searchFormData: {
  51. contract_name: '',
  52. phone: ''
  53. }, // 搜索栏数据
  54. curRoles: '',
  55. customerList: [],
  56. loadmore: {
  57. status: 'loadmore',
  58. loadingText: '努力加载中',
  59. defaultText: '轻轻上拉 查看更多',
  60. nomoreText: '实在没有了',
  61. currnetPage: 1
  62. }
  63. };
  64. },
  65. onLoad(params) {
  66. that = this;
  67. const userInfo2 = uni.getStorageSync('MD_userInfo2')
  68. this.curRoles = userInfo2 ? userInfo2.roles : ''
  69. // 默认筛选项
  70. if (params.filterStepStatus !== undefined) {
  71. that.filterStepStatus = parseInt(params.filterStepStatus);
  72. this.filterDropdownValue = [[],[],[],[that.filterStepStatus],[]]
  73. }
  74. this.getDataList()
  75. },
  76. onReachBottom() {
  77. if (that.loadmore.status == 'nomore') return;
  78. that.loadmore.currnetPage++
  79. this.getDataList()
  80. },
  81. onPullDownRefresh() {
  82. // 防止频繁刷新
  83. },
  84. methods: {
  85. linkWebView (item) {
  86. let params = {
  87. id: item.id,
  88. url: item.contract_pdf_pub,
  89. tname: item.contract_name
  90. }
  91. uni.setStorageSync('MD_contractObj', params)
  92. uni.navigateTo({
  93. url: `/pages/user/contract/dtl?id=${item.id}`
  94. })
  95. },
  96. delHandle (item) {
  97. uni.$msgConfirm('确定删除吗?', () => {
  98. uni.api.base.apicontractdel({
  99. id: item.id
  100. }).then(res => {
  101. uni.$msg('删除成功~')
  102. this.loadmore.currnetPage = 1
  103. this.getDataList()
  104. })
  105. })
  106. },
  107. getDataList (bc) {
  108. const that = this
  109. let params = {
  110. ...this.searchFormData
  111. }
  112. uni.api.base.apicontractlist({
  113. page: that.loadmore.currnetPage,
  114. ...params,
  115. }).then(res => {
  116. const list = res.list || []
  117. if (list.length < 10) {
  118. that.loadmore.status = 'nomore';
  119. }
  120. if (res.current_page === 1) {
  121. if (list.length == 0) {
  122. uni.$msg('无搜索结果', 'none');
  123. }
  124. that.customerList = [...list]
  125. } else {
  126. that.customerList = that.customerList.concat(list)
  127. }
  128. if (bc) bc()
  129. })
  130. },
  131. customBack() {
  132. uni.navigateBack();
  133. },
  134. // 带监听器跳转
  135. pageTo(url, data) {
  136. /// xxxxx
  137. uni.navigateTo({
  138. url: url,
  139. events: {
  140. // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
  141. update: function(data) {
  142. // 当B页面运行 eventChannel.emit('update', { a:1 }); 时,会运行这里的代码逻辑。
  143. }
  144. },
  145. success: function(res) {
  146. // 通过eventChannel向被打开页面传送数据
  147. res.eventChannel.emit('data', data);
  148. }
  149. });
  150. },
  151. searchHandle() {
  152. that.loadmore.currnetPage = 1
  153. this.getDataList(() => {
  154. this.searchPopupShow = false
  155. })
  156. },
  157. }
  158. };
  159. </script>
  160. <style lang="scss">
  161. .search-wrap {
  162. padding: 20rpx;
  163. }
  164. .filter-wrap {
  165. position: relative;
  166. }
  167. // 列表
  168. .scoped-list-pdf {
  169. width: 100%;
  170. }
  171. .float-search {
  172. opacity: 0.9;
  173. position: fixed;
  174. right: 20rpx;
  175. bottom: 40rpx;
  176. padding: 20rpx;
  177. border-radius: 50%;
  178. background-color: $u-theme-color;
  179. }
  180. .float-search2 {
  181. opacity: 0.9;
  182. position: fixed;
  183. right: 20rpx;
  184. bottom: 150rpx;
  185. padding: 20rpx;
  186. border-radius: 50%;
  187. background-color: $u-theme-color;
  188. }
  189. .scoped-list-pdf {
  190. .slp-item {
  191. padding: 20rpx;
  192. border-bottom: 1PX solid #eee;
  193. position: relative;
  194. .slp-info {
  195. width: calc(80%);
  196. }
  197. .p1 {
  198. font-size: 32rpx;
  199. font-weight: bold;
  200. color: #313131;
  201. padding-bottom: 10rpx;
  202. }
  203. .p2 {
  204. font-size: 28rpx;
  205. color: #666;
  206. }
  207. .img {
  208. position: absolute;
  209. right: 20rpx;
  210. bottom: 20rpx;
  211. }
  212. }
  213. }
  214. </style>