dietDetail.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478
  1. <template>
  2. <view class="content">
  3. <view class="datebox">
  4. <view class="form-item">
  5. <text class="label">日期</text>
  6. <picker class="birth-picker" mode="date" @change="bindDateChange">
  7. <view class="right-box">
  8. <view class="input-box">
  9. <input type="text" :value="form.recordDate" placeholder="请选择日期" placeholder-class="form-input" disabled="disabled" />
  10. </view>
  11. <image class="w48 h48" src="@/static/images/health/right_arrow_right_icon24.png"></image>
  12. </view>
  13. </picker>
  14. </view>
  15. <view class="form-item">
  16. <text class="label">记录时间</text>
  17. <picker class="birth-picker" mode="time" :start="time" @change="bindTimeChange">
  18. <view class="right-box">
  19. <view class="input-box">
  20. <input type="text" :value="form.recordTime" placeholder="请选择时间" placeholder-class="form-input" disabled="disabled" />
  21. </view>
  22. <image class="w48 h48" src="@/static/images/health/right_arrow_right_icon24.png"></image>
  23. </view>
  24. </picker>
  25. </view>
  26. </view>
  27. <view class="datebox2">
  28. <view class="bold">用餐情况</view>
  29. <view class="textinput">
  30. <textarea v-model="form.mealDescription" auto-height maxlength='500' placeholder="请输入用餐详情,例如:消炒冬瓜,南瓜粥等等" />
  31. </view>
  32. </view>
  33. <view class="btn-box">
  34. <view class="sub-btn" @click="submit()">
  35. 记录
  36. </view>
  37. </view>
  38. </view>
  39. </template>
  40. <script>
  41. import {addRecord,editRecord,getRecordInfo} from '@/api/companyUser.js'
  42. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  43. export default {
  44. mixins: [MescrollMixin],
  45. data() {
  46. return {
  47. time:this.utils.timeFormat(new Date(),'hh:MM'),
  48. type:null,
  49. showType:1,
  50. mescroll:null,
  51. // 上拉加载的配置
  52. upOption: {
  53. onScroll:true,
  54. use: true, // 是否启用上拉加载; 默认true
  55. page: {
  56. num: 0, // 当前页码,默认0,回调之前会加1,即callback(page)会从1开始
  57. size: 10 // 每页数据的数量,默认10
  58. },
  59. noMoreSize: 10, // 配置列表的总数量要大于等于5条才显示'-- END --'的提示
  60. empty: {
  61. icon:'/static/images/no_data.png',
  62. tip: '暂无数据'
  63. }
  64. },
  65. form:{
  66. recordDate:null,
  67. recordTime:null,
  68. mealDescription:null
  69. }
  70. }
  71. },
  72. onLoad(option) {
  73. this.type=option.type;
  74. console.log(this.type)
  75. if(this.type=='edit'){
  76. this.recordId=option.id;
  77. this.getRecordInfo();
  78. }
  79. },
  80. methods: {
  81. navgetTo(url){
  82. uni.navigateTo({
  83. url:url
  84. })
  85. },
  86. bindDateChange: function(e) {
  87. this.form.recordDate = e.target.value
  88. },
  89. bindTimeChange: function(e) {
  90. this.form.recordTime = e.target.value
  91. },
  92. getRecordInfo(){
  93. var data={id:this.recordId};
  94. getRecordInfo(this.recordId).then(
  95. res => {
  96. if(res.code==200){
  97. this.form=res.record;
  98. this.form.recordTime=this.form.recordTime.slice(0,5)
  99. }else{
  100. uni.showToast({
  101. title: res.msg,
  102. });
  103. }
  104. },
  105. rej => {}
  106. );
  107. },
  108. submit(){
  109. if(this.form.recordDate==null){
  110. uni.showToast({
  111. icon:'none',
  112. title: "日期不能为空",
  113. });
  114. return;
  115. }
  116. if(this.form.recordTime==null){
  117. uni.showToast({
  118. icon:'none',
  119. title: "记录时间不能为空",
  120. });
  121. return;
  122. }
  123. if(this.form.mealDescription==null){
  124. uni.showToast({
  125. icon:'none',
  126. title: "用餐情况不能为空",
  127. });
  128. return;
  129. }
  130. if(this.type=="add"){
  131. this.addRecord()
  132. }
  133. else if(this.type=="edit"){
  134. this.editRecord()
  135. }
  136. },
  137. editRecord(){
  138. editRecord(this.form).then(
  139. res => {
  140. if(res.code==200){
  141. uni.showToast({
  142. icon:'success',
  143. title: "操作成功",
  144. });
  145. setTimeout(function() {
  146. uni.$emit('refreshDietList');
  147. uni.$emit('refreshExecutionRecord');
  148. uni.navigateBack({
  149. delta: 1
  150. })
  151. }, 500);
  152. }else{
  153. uni.showToast({
  154. icon:'none',
  155. title: res.msg,
  156. });
  157. }
  158. },
  159. rej => {}
  160. );
  161. },
  162. addRecord(){
  163. addRecord(this.form).then(
  164. res => {
  165. if(res.code==200){
  166. uni.showToast({
  167. icon:'success',
  168. title: "操作成功",
  169. });
  170. setTimeout(function() {
  171. uni.$emit('refreshDietList');
  172. uni.$emit('refreshExecutionRecord');
  173. uni.navigateBack({
  174. delta: 1
  175. })
  176. }, 500);
  177. }else{
  178. uni.showToast({
  179. icon:'none',
  180. title: res.msg,
  181. });
  182. }
  183. },
  184. rej => {}
  185. );
  186. },
  187. }
  188. }
  189. </script>
  190. <style lang="scss" scoped>
  191. @mixin u-flex($flexD, $alignI, $justifyC) {
  192. display: flex;
  193. flex-direction: $flexD;
  194. align-items: $alignI;
  195. justify-content: $justifyC;
  196. }
  197. .flex-bt {
  198. @include u-flex(row, center, space-between);
  199. }
  200. .default {
  201. font-weight: 400;
  202. font-size: 28rpx;
  203. color: #999999;
  204. }
  205. .content{
  206. padding: 20upx;
  207. .datebox {
  208. padding: 0 30rpx;
  209. margin-bottom: 20rpx;
  210. background: #FFFFFF;
  211. border-radius: 16rpx 16rpx 16rpx 16rpx;
  212. .form-item{
  213. padding: 30upx 0;
  214. display: flex;
  215. align-items: flex-start;
  216. border-bottom: 1px solid #F1F1F1;
  217. &:last-child{
  218. border-bottom: none;
  219. }
  220. .label{
  221. flex:1;
  222. font-family: PingFang SC, PingFang SC;
  223. font-weight: 500;
  224. font-size: 32rpx;
  225. color: #222426;
  226. line-height: 34rpx;
  227. text-align: left;
  228. }
  229. input{
  230. text-align: right;
  231. }
  232. .form-input{
  233. font-size: 30upx;
  234. font-family: PingFang SC;
  235. font-weight: 500;
  236. color: #999999;
  237. text-align: right;
  238. }
  239. .form-textarea{
  240. font-size: 30upx;
  241. color: #999999;
  242. height: 100upx;
  243. padding: 4upx 0;
  244. }
  245. .birth-picker {
  246. flex: 1;
  247. display: flex;
  248. align-items: center;
  249. .right-box{
  250. width: 100%;
  251. display: flex;
  252. align-items: center;
  253. .input-box{
  254. // width: 470upx;
  255. }
  256. .arrow{
  257. width: 13upx;
  258. height: 23upx;
  259. margin-left: 20upx;
  260. }
  261. }
  262. }
  263. }
  264. }
  265. .datebox2{
  266. background: #FFFFFF;
  267. padding:30rpx;
  268. border-radius: 16rpx 16rpx 16rpx 16rpx;
  269. .textinput{
  270. margin-top: 30rpx;
  271. height:200rpx;
  272. overflow-y: scroll;
  273. }
  274. }
  275. .top-fixed{
  276. width: 100%;
  277. position: fixed;
  278. top: 0;
  279. left: 0;
  280. z-index: 10;
  281. }
  282. .pub-tab-box{
  283. box-sizing: border-box;
  284. width: 100%;
  285. padding: 0 40upx;
  286. background-color: #FFFFFF;
  287. .tab-inner{
  288. height: 88upx;
  289. line-height: 88upx;
  290. display: flex;
  291. align-items: center;
  292. justify-content: space-between;
  293. overflow-x: auto;
  294. }
  295. .item{
  296. flex:1;
  297. font-size: 28upx;
  298. white-space: nowrap;
  299. line-height: 1;
  300. font-family: PingFang SC;
  301. font-weight: 500;
  302. color: #626468;
  303. // margin-right: 60upx;
  304. display: flex;
  305. align-items: center;
  306. justify-content: center;
  307. &:last-child{
  308. margin-right: 0;
  309. }
  310. &.active{
  311. font-weight: bold;
  312. color:#008FD3;
  313. &::after {
  314. content: "";
  315. width: 48rpx;
  316. height: 8rpx;
  317. background: linear-gradient(120deg, #31A1FE 0%, #008FD3 100%);
  318. position: absolute;
  319. bottom: 0;
  320. border-radius: 6upx 6upx 0upx 0;
  321. }
  322. }
  323. .text{
  324. position: relative;
  325. z-index: 1;
  326. }
  327. .tab-bg{
  328. width: 72upx;
  329. height: 28upx;
  330. position: absolute;
  331. top: 17upx;
  332. left: 50%;
  333. transform: translateX(-36upx);
  334. z-index: -1;
  335. }
  336. }
  337. }
  338. .btn-box{
  339. z-index: 9999;
  340. width: 100%;
  341. padding: 30upx;
  342. // position: fixed;
  343. bottom: 0;
  344. left: 0;
  345. box-sizing: border-box;
  346. // background: #FFFFFF;
  347. display: flex;
  348. align-items: center;
  349. justify-content: space-between;
  350. padding-bottom: 40rpx;
  351. .sub-btn{
  352. flex:1;
  353. // width: 100%;
  354. height: 88upx;
  355. line-height: 88upx;
  356. text-align: center;
  357. font-size: 32upx;
  358. font-family: PingFang SC;
  359. font-weight: bold;
  360. color: #FFFFFF;
  361. background: #008FD3;
  362. border-radius: 44upx;
  363. display: flex;
  364. align-items: center;
  365. border: 2rpx solid #008FD3;
  366. justify-content: center;
  367. image{
  368. margin-right: 16rpx;
  369. }
  370. }
  371. .sub-btn2{
  372. flex:1;
  373. height: 88upx;
  374. line-height: 88upx;
  375. text-align: center;
  376. font-size: 32rpx;
  377. color: #008FD3;
  378. font-family: PingFang SC;
  379. font-weight: bold;
  380. background: #FFFFFF;
  381. border-radius: 44rpx 44rpx 44rpx 44rpx;
  382. border: 2rpx solid #008FD3;
  383. margin-right: 20rpx;
  384. }
  385. }
  386. .phone-list{
  387. // padding: 30rpx;
  388. .item{
  389. display: flex;
  390. align-items: center;
  391. justify-content: space-between;
  392. background: #FFFFFF;
  393. border-radius: 16rpx 16rpx 16rpx 16rpx;
  394. // border-bottom: 1rpx solid #ECECEC;
  395. padding: 20rpx;
  396. margin-bottom: 20rpx;
  397. &:last-child{
  398. margin-bottom: 0;
  399. }
  400. .phone-name{
  401. display: flex;
  402. flex-direction: column;
  403. align-items: flex-start;
  404. // justify-content: flex-start;
  405. // padding-left: 24rpx;
  406. flex: 1;
  407. .name{
  408. font-family: PingFang SC, PingFang SC;
  409. font-weight: 500;
  410. font-size: 32rpx;
  411. color: #222426;
  412. text-align: left;
  413. }
  414. .type{
  415. font-family: PingFang SC;
  416. font-weight: 400;
  417. font-size: 28rpx;
  418. color: #626468;
  419. text-align: right;
  420. }
  421. .time{
  422. font-family: PingFang SC;
  423. font-weight: 400;
  424. font-size: 24rpx;
  425. color: #898E91;
  426. text-align: left;
  427. margin-top: 14rpx;
  428. }
  429. }
  430. }
  431. }
  432. .sms-list{
  433. .item{
  434. padding: 30rpx;
  435. background: #FFFFFF;
  436. border-radius: 16rpx 16rpx 16rpx 16rpx;
  437. margin-bottom: 20rpx;
  438. .title{
  439. font-family: PingFang SC;
  440. font-weight: 500;
  441. font-size: 32rpx;
  442. color: #222426;
  443. text-align: left;
  444. }
  445. .box{
  446. display: flex;
  447. align-items: center;
  448. justify-content: space-between;
  449. padding-top: 22rpx;
  450. .time{
  451. font-family: PingFang SC;
  452. font-weight: 400;
  453. font-size: 24rpx;
  454. color: #898E91;
  455. text-align: left;
  456. }
  457. .state{
  458. font-family: PingFang SC;
  459. font-weight: 400;
  460. font-size: 24rpx;
  461. color: #2CAE5C;
  462. text-align: right;
  463. }
  464. }
  465. }
  466. }
  467. }
  468. </style>