dietList.vue 8.8 KB

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