schedule.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346
  1. <template>
  2. <view class="content">
  3. <ren-calendar ref='ren' :markDays='markDays' :headerBar='false' @onDayClick='onDayClick'></ren-calendar>
  4. <view class="inner">
  5. <view class="title-box align-center">
  6. <text>我的行程</text>
  7. <view class="num">(3)</view>
  8. </view>
  9. <view class="form-box">
  10. <u-swipe-action>
  11. <view class="form-swipe mb20" v-for="(item,index) in dataList" :key="index">
  12. <u-swipe-action-item :options="options" @click="action()">
  13. <view class="form-item">
  14. <view class="left">
  15. <text class="label">已开始</text>
  16. <text class="time">{{item.time}}</text>
  17. </view>
  18. <view class="right">
  19. <view>{{item.content}}</view>
  20. </view>
  21. </view>
  22. </u-swipe-action-item>
  23. </view>
  24. </u-swipe-action>
  25. </view>
  26. <view class="btn-box">
  27. <view class="sub-btn" @click="addSchedule()">
  28. <image class="w32 h32" src="@/static/images/company/add_icon.png"></image>
  29. <text>添加日程</text>
  30. </view>
  31. </view>
  32. </view>
  33. </view>
  34. </template>
  35. <script>
  36. import RenCalendar from '@/components/ren-calendar/ren-calendar.vue'
  37. import {
  38. getDocDetails,
  39. addDoc,
  40. editDoc
  41. } from '@/api/doc.js'
  42. export default {
  43. components:{
  44. RenCalendar
  45. },
  46. data() {
  47. return {
  48. options: [{
  49. text: '修改',
  50. style: {
  51. backgroundColor: '#008FD3'
  52. }
  53. }, {
  54. text: '删除',
  55. style: {
  56. backgroundColor: '#FF5030'
  57. }
  58. }],
  59. curDate:'',
  60. markDays:[],
  61. type: null,
  62. patientId: null,
  63. famaleurl:"/static/images/health/female_profile.png",
  64. maleurl:"/static/images/health/my_heads.png",
  65. checked:1,
  66. dataList:[{id:1,time:'09:00',content:'酒店登记入驻,记得检查马桶卫生和柏子是否干净'},
  67. {id:2,time:'09:00',content:'收拾好行李,准备去医院'},
  68. {id:3,time:'16:30',content:'酒店登记入驻,记得检查马桶卫生和柏子是否干净'},
  69. ],
  70. form: {
  71. userName: null,
  72. idCard: null,
  73. sex: null,
  74. birthday: null,
  75. remark: null,
  76. }
  77. };
  78. },
  79. onLoad(option) {
  80. let today = this.$refs.ren.getToday().date;
  81. this.curDate = today;
  82. this.markDays.push(today);
  83. this.type = option.type;
  84. console.log(this.type)
  85. if (this.type == 'edit') {
  86. this.docId = option.docId;
  87. // this.getDocDetails();
  88. }
  89. },
  90. methods: {
  91. //日历
  92. onDayClick(data){
  93. this.curDate = data.date;
  94. },
  95. action(e){
  96. console.log(e,'--')
  97. },
  98. addSchedule(){
  99. uni.navigateTo({
  100. url: '/pages_company/addSchedule'
  101. })
  102. },
  103. getDocDetails() {
  104. var data = {
  105. docId: this.docId
  106. };
  107. getDocDetails(data).then(
  108. res => {
  109. if (res.code == 200) {
  110. this.form = res.data;
  111. } else {
  112. uni.showToast({
  113. title: res.msg,
  114. });
  115. }
  116. },
  117. rej => {}
  118. );
  119. },
  120. submit() {
  121. if (this.form.userName == null) {
  122. uni.showToast({
  123. icon: 'none',
  124. title: "姓名不能为空",
  125. });
  126. return;
  127. }
  128. if (this.form.idCard == null) {
  129. uni.showToast({
  130. icon: 'none',
  131. title: "身份证号不能为空",
  132. });
  133. return;
  134. }
  135. if (this.form.sex == null) {
  136. uni.showToast({
  137. icon: 'none',
  138. title: "性别不能为空",
  139. });
  140. return;
  141. }
  142. if (this.form.birthday == null) {
  143. uni.showToast({
  144. icon: 'none',
  145. title: "出生年月不能为空",
  146. });
  147. return;
  148. }
  149. if (this.type == "add") {
  150. this.addDoc()
  151. } else if (this.type == "edit") {
  152. this.editDoc()
  153. }
  154. },
  155. editDoc() {
  156. editDoc(this.form).then(
  157. res => {
  158. if (res.code == 200) {
  159. uni.showToast({
  160. icon: 'success',
  161. title: "操作成功",
  162. });
  163. setTimeout(function() {
  164. uni.$emit('refreshDoc');
  165. uni.navigateBack({
  166. delta: 1
  167. })
  168. }, 500);
  169. } else {
  170. uni.showToast({
  171. icon: 'none',
  172. title: res.msg,
  173. });
  174. }
  175. },
  176. rej => {}
  177. );
  178. },
  179. addDoc() {
  180. addDoc(this.form).then(
  181. res => {
  182. if (res.code == 200) {
  183. uni.showToast({
  184. icon: 'success',
  185. title: "操作成功",
  186. });
  187. setTimeout(function() {
  188. uni.$emit('refreshDoc');
  189. uni.navigateBack({
  190. delta: 1
  191. })
  192. }, 500);
  193. } else {
  194. uni.showToast({
  195. icon: 'none',
  196. title: res.msg,
  197. });
  198. }
  199. },
  200. rej => {}
  201. );
  202. },
  203. // 出生日期选择
  204. bindDateChange: function(e) {
  205. this.form.birthday = e.target.value
  206. },
  207. }
  208. }
  209. </script>
  210. <style lang="scss">
  211. page {
  212. height: 100%;
  213. background: #FFFFFF;
  214. }
  215. .u-swipe-action-item__right__button__wrapper__text{
  216. font-size: 28rpx !important;
  217. line-height: 28rpx !important;
  218. }
  219. .content {
  220. height: 100%;
  221. // display: flex;
  222. // flex-direction: column;
  223. // justify-content: space-between;
  224. .inner {
  225. // height: calc(100% - 120upx);
  226. padding:30upx;
  227. background: #FFFFFF;
  228. border-radius:16rpx 16rpx 16rpx 16rpx;
  229. margin-top:-20rpx;
  230. position: relative;
  231. .title-box{
  232. text{
  233. font-family: PingFang SC, PingFang SC;
  234. font-weight: 600;
  235. font-size: 36rpx;
  236. color: #222426;
  237. padding: 24rpx 0;
  238. }
  239. .num{
  240. font-weight: 500;
  241. font-size: 28rpx;
  242. color: #898E91;
  243. }
  244. }
  245. .select-box2{
  246. width: 216rpx;
  247. height: 64rpx;
  248. background: #FFFFFF;
  249. border-radius: 32rpx 32rpx 32rpx 32rpx;
  250. display: flex;
  251. align-items: center;
  252. justify-content: center;
  253. text{
  254. font-family: PingFang SC;
  255. font-weight: 400;
  256. font-size: 24rpx;
  257. color: #626468;
  258. margin-left: 5rpx;
  259. }
  260. }
  261. }
  262. .form-box {
  263. // padding:30upx;
  264. // background: #FFFFFF;
  265. // border-radius: 16upx;
  266. .form-swipe{
  267. overflow: hidden;
  268. border-radius: 16rpx 16rpx 16rpx 16rpx;
  269. }
  270. .form-item {
  271. padding: 30upx;
  272. display: flex;
  273. align-items: center;
  274. // justify-content: space-between;
  275. background: #F5F7FA;
  276. .left{
  277. display: flex;
  278. flex-direction: column;
  279. align-items: center;
  280. padding-right: 30rpx;
  281. border-right: 1px solid #CCCCCC;
  282. .label{
  283. font-weight: 400;
  284. font-size: 24rpx;
  285. color: #626468;
  286. }
  287. .time{
  288. font-family: PingFang SC;
  289. font-weight: 500;
  290. font-size: 48rpx;
  291. }
  292. }
  293. .right{
  294. padding-left: 30rpx;
  295. view{
  296. font-weight: 400;
  297. font-size: 24rpx;
  298. color: #222426;
  299. text-align: left;
  300. }
  301. }
  302. }
  303. }
  304. .btn-box {
  305. // display: flex;
  306. // align-items: center;
  307. // justify-content: center;
  308. position: fixed;
  309. right: 20rpx;
  310. bottom: 20%;
  311. z-index: 999;
  312. // transform: translate(-50%,-50%);
  313. // background: #FFFFFF;
  314. .sub-btn {
  315. display: flex;
  316. align-items: center;
  317. justify-content: center;
  318. width: 192rpx;
  319. height: 80rpx;
  320. background: #008FD3;
  321. box-shadow: 0rpx 6rpx 10rpx 0rpx rgba(0,143,211,0.2);
  322. border-radius: 40rpx 40rpx 40rpx 40rpx;
  323. text{
  324. color: #fff;
  325. font-family: PingFang SC;
  326. font-weight: 500;
  327. font-size: 28rpx;
  328. color: #FFFFFF;
  329. }
  330. }
  331. }
  332. }
  333. </style>