reportList.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408
  1. <template>
  2. <view class="content">
  3. <mescroll-body ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" :down="downOption"
  4. :up="upOption">
  5. <view class="phone-list">
  6. <u-swipe-action>
  7. <view class="form-swipe mb20" v-for="(item,index) in dataList" :key="index">
  8. <u-swipe-action-item :options="options" @click="cancel(item,index)" :name="index"
  9. :ref="'swipeAction' + index">
  10. <view class="item" @click.stop="showDetail(item)">
  11. <view class="phone-name">
  12. <view class="name">体检报告</view>
  13. <view class="time">{{item.examDate}}</view>
  14. </view>
  15. <image src="/static/images/health/right_arrow_right_icon24.png" class="w48 h48"></image>
  16. </view>
  17. </u-swipe-action-item>
  18. </view>
  19. </u-swipe-action>
  20. </view>
  21. <view class="h150"></view>
  22. </mescroll-body>
  23. <view class="btn-box2">
  24. <view class="sub-btn2" @click="navgetTo('/pages_user/user/dataAnalysis',1)">
  25. <text>数据分析</text>
  26. </view>
  27. <view class="sub-btn" @click="navgetTo('/pages_user/user/information',2)">
  28. <image src="/static/images/health/nav_add_icon24.png" class="w48 h48"></image>
  29. <text>新增</text>
  30. </view>
  31. </view>
  32. </view>
  33. </template>
  34. <script>
  35. import {
  36. getReportList,
  37. deleteReport
  38. } from '@/api/companyUser.js'
  39. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  40. export default {
  41. mixins: [MescrollMixin],
  42. data() {
  43. return {
  44. orderStatus: [{
  45. name: "电话记录",
  46. val: 1
  47. },
  48. {
  49. name: "短信记录",
  50. val: 2
  51. },
  52. ],
  53. options: [{
  54. text: '删除',
  55. style: {
  56. backgroundColor: '#FF5030'
  57. }
  58. }],
  59. showType: 1,
  60. mescroll: null,
  61. // 上拉加载的配置
  62. upOption: {
  63. onScroll: true,
  64. use: true, // 是否启用上拉加载; 默认true
  65. page: {
  66. num: 0, // 当前页码,默认0,回调之前会加1,即callback(page)会从1开始
  67. size: 10 // 每页数据的数量,默认10
  68. },
  69. noMoreSize: 10, // 配置列表的总数量要大于等于5条才显示'-- END --'的提示
  70. empty: {
  71. icon: 'https://user.test.ylrztop.com/images/empty_icon.png',
  72. tip: '暂无数据'
  73. }
  74. },
  75. // 列表数据
  76. dataList: [
  77. // {orderId:1, name:'今日 11:22',time:'4分16秒'},
  78. // {orderId:2, name:'昨天 09:16',time:'4分16秒'},
  79. // {orderId:3, name:'1月12 13:06',time:'4分16秒'}
  80. ],
  81. }
  82. },
  83. onLoad(options) {
  84. this.userId=options.userId;
  85. this.companyUserId = options.companyUserId;
  86. uni.$on('refreshReportList', () => {
  87. this.mescroll.resetUpScroll()
  88. })
  89. },
  90. methods: {
  91. navgetTo(url, index) {
  92. uni.navigateTo({
  93. url: url + '?type=add&userId=' + this.userId + "&companyUserId="+this.companyUserId
  94. })
  95. },
  96. cancel(item, index) {
  97. var that = this;
  98. let test = 'swipeAction' + index
  99. uni.showModal({
  100. title: '提示',
  101. content: '确定删除体检报告吗',
  102. success: function(res) {
  103. if (res.confirm) {
  104. // var data = {
  105. // orderId:item.orderId
  106. // };
  107. deleteReport(item.reportId).then(res => {
  108. if (res.code == 200) {
  109. uni.showToast({
  110. icon: 'success',
  111. title: '删除成功',
  112. });
  113. that.$refs[test][0].closeHandler()
  114. that.mescroll.resetUpScroll()
  115. } else {
  116. uni.showToast({
  117. icon: 'none',
  118. title: res.msg,
  119. });
  120. }
  121. });
  122. } else if (res.cancel) {
  123. that.$refs[test][0].closeHandler()
  124. }
  125. }
  126. });
  127. },
  128. mescrollInit(mescroll) {
  129. this.mescroll = mescroll;
  130. },
  131. /*下拉刷新的回调 */
  132. downCallback(mescroll) {
  133. mescroll.resetUpScroll()
  134. },
  135. upCallback(page) {
  136. //联网加载数据
  137. var that = this;
  138. var data = {
  139. userId: this.userId,
  140. companyUserId: this.companyUserId,
  141. reportStatus: 1,
  142. pageNum: page.num,
  143. pageSize: page.size
  144. };
  145. getReportList(data).then(res => {
  146. if (res.code == 200) {
  147. //设置列表数据
  148. if (page.num == 1) {
  149. that.dataList = res.data.list;
  150. } else {
  151. that.dataList = that.dataList.concat(res.data.list);
  152. }
  153. that.mescroll.endBySize(res.data.list.length, res.data.total);
  154. } else {
  155. uni.showToast({
  156. icon: 'none',
  157. title: "请求失败",
  158. });
  159. that.dataList = null;
  160. that.mescroll.endErr();
  161. }
  162. });
  163. },
  164. showDetail(item) {
  165. uni.navigateTo({
  166. url: '/pages_user/user/information?type=edit&id=' + item.reportId + '&userId=' + this.userId + "&companyUserId=" + this.companyUserId
  167. })
  168. }
  169. }
  170. }
  171. </script>
  172. <style lang="scss">
  173. .content {
  174. padding: 20upx;
  175. .top-fixed {
  176. width: 100%;
  177. position: fixed;
  178. top: 0;
  179. left: 0;
  180. z-index: 10;
  181. }
  182. .pub-tab-box {
  183. box-sizing: border-box;
  184. width: 100%;
  185. padding: 0 40upx;
  186. background-color: #FFFFFF;
  187. .tab-inner {
  188. height: 88upx;
  189. line-height: 88upx;
  190. display: flex;
  191. align-items: center;
  192. justify-content: space-between;
  193. overflow-x: auto;
  194. }
  195. .item {
  196. flex: 1;
  197. font-size: 28upx;
  198. white-space: nowrap;
  199. line-height: 1;
  200. font-family: PingFang SC;
  201. font-weight: 500;
  202. color: #626468;
  203. // margin-right: 60upx;
  204. display: flex;
  205. align-items: center;
  206. justify-content: center;
  207. &:last-child {
  208. margin-right: 0;
  209. }
  210. &.active {
  211. font-weight: bold;
  212. color: #008FD3;
  213. &::after {
  214. content: "";
  215. width: 48rpx;
  216. height: 8rpx;
  217. background: linear-gradient(120deg, #31A1FE 0%, #008FD3 100%);
  218. position: absolute;
  219. bottom: 0;
  220. border-radius: 6upx 6upx 0upx 0;
  221. }
  222. }
  223. .text {
  224. position: relative;
  225. z-index: 1;
  226. }
  227. .tab-bg {
  228. width: 72upx;
  229. height: 28upx;
  230. position: absolute;
  231. top: 17upx;
  232. left: 50%;
  233. transform: translateX(-36upx);
  234. z-index: -1;
  235. }
  236. }
  237. }
  238. .btn-box2 {
  239. z-index: 9999;
  240. width: 100%;
  241. padding: 30upx;
  242. position: fixed;
  243. bottom: 0;
  244. left: 0;
  245. box-sizing: border-box;
  246. background: #FFFFFF;
  247. display: flex;
  248. align-items: center;
  249. justify-content: space-between;
  250. padding-bottom: 40rpx;
  251. .sub-btn {
  252. flex: 1;
  253. // width: 100%;
  254. height: 88upx;
  255. line-height: 88upx;
  256. text-align: center;
  257. font-size: 32upx;
  258. font-family: PingFang SC;
  259. font-weight: bold;
  260. color: #FFFFFF;
  261. background: #008FD3;
  262. border-radius: 44upx;
  263. display: flex;
  264. align-items: center;
  265. border: 2rpx solid #008FD3;
  266. justify-content: center;
  267. image {
  268. margin-right: 16rpx;
  269. }
  270. }
  271. .sub-btn2 {
  272. flex: 1;
  273. height: 88upx;
  274. line-height: 88upx;
  275. text-align: center;
  276. font-size: 32rpx;
  277. color: #008FD3;
  278. font-family: PingFang SC;
  279. font-weight: bold;
  280. background: #FFFFFF;
  281. border-radius: 44rpx 44rpx 44rpx 44rpx;
  282. border: 2rpx solid #008FD3;
  283. margin-right: 20rpx;
  284. }
  285. }
  286. .phone-list {
  287. // padding: 30rpx;
  288. .form-swipe {
  289. overflow: hidden;
  290. border-radius: 16rpx 16rpx 16rpx 16rpx;
  291. }
  292. .item {
  293. display: flex;
  294. align-items: center;
  295. justify-content: space-between;
  296. background: #FFFFFF;
  297. border-radius: 16rpx 16rpx 16rpx 16rpx;
  298. // border-bottom: 1rpx solid #ECECEC;
  299. padding: 20rpx;
  300. margin-bottom: 20rpx;
  301. &:last-child {
  302. margin-bottom: 0;
  303. }
  304. .phone-name {
  305. display: flex;
  306. flex-direction: column;
  307. align-items: flex-start;
  308. // justify-content: flex-start;
  309. // padding-left: 24rpx;
  310. flex: 1;
  311. .name {
  312. font-family: PingFang SC, PingFang SC;
  313. font-weight: 500;
  314. font-size: 32rpx;
  315. color: #222426;
  316. text-align: left;
  317. }
  318. .type {
  319. font-family: PingFang SC;
  320. font-weight: 400;
  321. font-size: 28rpx;
  322. color: #626468;
  323. text-align: right;
  324. }
  325. .time {
  326. font-family: PingFang SC;
  327. font-weight: 400;
  328. font-size: 24rpx;
  329. color: #898E91;
  330. text-align: left;
  331. margin-top: 14rpx;
  332. }
  333. }
  334. }
  335. }
  336. .sms-list {
  337. .item {
  338. padding: 30rpx;
  339. background: #FFFFFF;
  340. border-radius: 16rpx 16rpx 16rpx 16rpx;
  341. margin-bottom: 20rpx;
  342. .title {
  343. font-family: PingFang SC;
  344. font-weight: 500;
  345. font-size: 32rpx;
  346. color: #222426;
  347. text-align: left;
  348. }
  349. .box {
  350. display: flex;
  351. align-items: center;
  352. justify-content: space-between;
  353. padding-top: 22rpx;
  354. .time {
  355. font-family: PingFang SC;
  356. font-weight: 400;
  357. font-size: 24rpx;
  358. color: #898E91;
  359. text-align: left;
  360. }
  361. .state {
  362. font-family: PingFang SC;
  363. font-weight: 400;
  364. font-size: 24rpx;
  365. color: #2CAE5C;
  366. text-align: right;
  367. }
  368. }
  369. }
  370. }
  371. }
  372. </style>