hipsList.vue 8.2 KB

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