addForm.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424
  1. <template>
  2. <view class="content">
  3. <view class="inner">
  4. <view class="form-box">
  5. <view class="form-item">
  6. <text class="label"><text class="color-price">*</text> 姓名</text>
  7. <input class="input-width" type="text" v-model="form.productName" placeholder="请输入姓名"
  8. placeholder-class="form-input" />
  9. </view>
  10. <view class="form-item">
  11. <text class="label"><text class="color-price">*</text> 医院</text>
  12. <input class="input-width" type="text" v-model="form.productName" placeholder="请输入医院"
  13. placeholder-class="form-input" />
  14. </view>
  15. <view class="form-item">
  16. <text class="label"><text class="color-price">*</text> 科室</text>
  17. <input class="input-width" type="text" v-model="form.productName" placeholder="请输入科室"
  18. placeholder-class="form-input" />
  19. </view>
  20. <view class="form-item">
  21. <text class="label"><text class="color-price">*</text> 职称</text>
  22. <input class="input-width" type="text" v-model="form.productName" placeholder="请输入职称"
  23. placeholder-class="form-input" />
  24. </view>
  25. </view>
  26. </view>
  27. <view class="btn-box">
  28. <view class="sub-btn" @click="submit()">
  29. <!-- <image src="/static/images/health/nav_add_icon24.png" class="w48 h48"></image> -->
  30. <text>确认并进入直播间</text>
  31. </view>
  32. </view>
  33. </view>
  34. </template>
  35. <script>
  36. import {
  37. getServiceById,updateService,saveService
  38. } from '@/api/companyUser.js'
  39. export default {
  40. data() {
  41. return {
  42. startDate:this.utils.timeFormat(new Date()),
  43. type: null,
  44. patientId: null,
  45. famaleurl:"/static/images/health/female_profile.png",
  46. maleurl:"/static/images/health/my_heads.png",
  47. checked:1,
  48. array:['是','否'],
  49. tags: [{
  50. name: '心脏病',
  51. checked:true,
  52. id: 1
  53. },
  54. {
  55. name: '脑梗死',
  56. checked:false,
  57. id: 2
  58. },{
  59. name: '肾病',
  60. checked:false,
  61. id: 3
  62. },{
  63. name: '脂肪肝',
  64. checked:false,
  65. id: 4
  66. }],
  67. form: {
  68. "amount": null,
  69. "memberStatus": null,
  70. "plannedCompletionDate": null,
  71. "productName":null,
  72. "purchaseQuantity":1,
  73. "purchaseTimes":null,
  74. "remark": null,
  75. "surplusTimes":null,
  76. },
  77. id:null
  78. };
  79. },
  80. onLoad(options) {
  81. this.type = options.type;
  82. this.form.userId=options.userId
  83. this.form.companyUserId=options.companyUserId;
  84. console.log(this.type)
  85. if (this.type == 'edit') {
  86. this.id=options.id;
  87. this.getServiceInfo();
  88. }
  89. },
  90. methods: {
  91. sexChange(type) {
  92. this.form.sex = type
  93. },
  94. radioClick(item) {
  95. this.checked=item.id
  96. },
  97. getServiceInfo() {
  98. var data = {
  99. id: this.id
  100. };
  101. getServiceById(data).then(
  102. res => {
  103. if (res.code == 200) {
  104. this.form = res.data;
  105. this.form.plannedCompletionDate=this.utils.timeFormat(res.data.plannedCompletionDate,'yyyy-mm-dd')
  106. this.startDate=this.form.plannedCompletionDate
  107. } else {
  108. uni.showToast({
  109. title: res.msg,
  110. });
  111. }
  112. },
  113. rej => {}
  114. );
  115. },
  116. submit() {
  117. uni.navigateTo({
  118. url: '/pages_live/card'
  119. })
  120. // if (this.form.productName == null || this.form.productName == '') {
  121. // uni.showToast({
  122. // icon: 'none',
  123. // title: "名称不能为空",
  124. // });
  125. // return;
  126. // }
  127. // if (this.form.purchaseQuantity == null|| this.form.purchaseQuantity == 0) {
  128. // uni.showToast({
  129. // icon: 'none',
  130. // title: "数量不能为空",
  131. // });
  132. // return;
  133. // }
  134. // if (this.form.amount == null|| this.form.amount == '') {
  135. // uni.showToast({
  136. // icon: 'none',
  137. // title: "金额不能为空",
  138. // });
  139. // return;
  140. // }
  141. // if (this.form.plannedCompletionDate == null|| this.form.plannedCompletionDate == '') {
  142. // uni.showToast({
  143. // icon: 'none',
  144. // title: "时间不能为空",
  145. // });
  146. // return;
  147. // }
  148. // if (this.form.purchaseTimes == null|| this.form.purchaseTimes == '') {
  149. // uni.showToast({
  150. // icon: 'none',
  151. // title: "购买次数不能为空",
  152. // });
  153. // return;
  154. // }
  155. // if (this.form.surplusTimes == null|| this.form.surplusTimes == '') {
  156. // uni.showToast({
  157. // icon: 'none',
  158. // title: "剩余次数不能为空",
  159. // });
  160. // return;
  161. // }
  162. // if (this.form.memberStatus == null|| this.form.memberStatus == '') {
  163. // uni.showToast({
  164. // icon: 'none',
  165. // title: "会员情况不能为空",
  166. // });
  167. // return;
  168. // }
  169. // if (this.type == "add") {
  170. // this.saveService()
  171. // } else if (this.type == "edit") {
  172. // this.updateService()
  173. // }
  174. },
  175. updateService() {
  176. updateService(this.form).then(
  177. res => {
  178. if (res.code == 200) {
  179. uni.showToast({
  180. icon: 'success',
  181. title: "操作成功",
  182. });
  183. setTimeout(function() {
  184. uni.$emit('refreshBuyOrder');
  185. uni.navigateBack({
  186. delta: 1
  187. })
  188. }, 500);
  189. } else {
  190. uni.showToast({
  191. icon: 'none',
  192. title: res.msg,
  193. });
  194. }
  195. },
  196. rej => {}
  197. );
  198. },
  199. saveService() {
  200. saveService(this.form).then(
  201. res => {
  202. if (res.code == 200) {
  203. uni.showToast({
  204. icon: 'success',
  205. title: "操作成功",
  206. });
  207. setTimeout(function() {
  208. uni.$emit('refreshBuyOrder');
  209. uni.navigateBack({
  210. delta: 1
  211. })
  212. }, 500);
  213. } else {
  214. uni.showToast({
  215. icon: 'none',
  216. title: res.msg,
  217. });
  218. }
  219. },
  220. rej => {}
  221. );
  222. },
  223. // 出生日期选择
  224. bindDateChange: function(e) {
  225. this.form.plannedCompletionDate = e.target.value
  226. },
  227. }
  228. }
  229. </script>
  230. <style lang="scss">
  231. page {
  232. height: 100%;
  233. }
  234. .content {
  235. height: 100%;
  236. display: flex;
  237. flex-direction: column;
  238. // justify-content: space-between;
  239. background: #FFFFFF;
  240. .inner {
  241. // height: calc(100% - 120upx);
  242. // padding: 20upx;
  243. .form-box {
  244. padding: 0 32upx;
  245. border-radius: 16upx;
  246. margin-bottom: 20upx;
  247. .form-title {
  248. font-family: PingFang SC;
  249. font-weight: 600;
  250. font-size: 40rpx;
  251. color: #222426;
  252. text-align: left;
  253. padding: 30rpx 0;
  254. display: block;
  255. }
  256. .form-item {
  257. padding: 30upx 0;
  258. display: flex;
  259. align-items: center;
  260. justify-content: space-between;
  261. border-bottom: 1px solid #F1F1F1;
  262. // &:last-child {
  263. // border-bottom: none;
  264. // }
  265. .label {
  266. width: 200upx;
  267. text-align: left;
  268. font-family: PingFang SC, PingFang SC;
  269. font-weight: 400;
  270. font-size: 28rpx;
  271. color: #666666;
  272. flex-shrink: 0;
  273. }
  274. input {
  275. flex:1;
  276. text-align: right;
  277. }
  278. .num-box{
  279. input{
  280. text-align: center !important;
  281. }
  282. }
  283. .form-input {
  284. font-size: 28rpx;
  285. font-family: PingFang SC;
  286. font-weight: 400;
  287. color: #C8C9CC;
  288. text-align: right;
  289. }
  290. .form-item-tag{
  291. margin-right: 16rpx;
  292. .tag{
  293. border-radius: 8rpx 8rpx 8rpx 8rpx;
  294. border: 2rpx solid #ECECEC;
  295. display: flex;
  296. align-items: center;
  297. padding: 24rpx;
  298. font-family: PingFang SC;
  299. font-weight: 400;
  300. font-size: 24rpx;
  301. &.active{
  302. background: #F0FAFF;
  303. border: 2rpx solid #008FD3;
  304. color: #008FD3;
  305. }
  306. }
  307. }
  308. .right{
  309. display: flex;
  310. align-items: center;
  311. }
  312. .sex-box{
  313. flex:1;
  314. display: flex;
  315. align-items: center;
  316. justify-content: flex-end;
  317. .sex-item{
  318. width: 146rpx;
  319. height: 64rpx;
  320. display: flex;
  321. align-items: center;
  322. justify-content: center;
  323. background: #F5F7FA;
  324. border-radius: 32rpx 32rpx 32rpx 32rpx;
  325. margin-left: 16rpx;
  326. .u-icon__icon{
  327. margin: 0;
  328. }
  329. text{
  330. // font-family: PingFang SC, PingFang SC;
  331. font-weight: 400;
  332. font-size: 28rpx;
  333. color: #898E91;
  334. margin-left: 12rpx;
  335. }
  336. &.active{
  337. background: #FCF0E7;
  338. text{
  339. color:#FF5030
  340. }
  341. }
  342. }
  343. }
  344. .form-textarea{
  345. font-size: 30upx;
  346. color: #999999;
  347. height: 100upx;
  348. padding: 4upx 0;
  349. }
  350. .birth-picker {
  351. flex: 1;
  352. display: flex;
  353. align-items: center;
  354. .right-box{
  355. width: 100%;
  356. display: flex;
  357. align-items: center;
  358. .input-box{
  359. // width: 470upx;
  360. }
  361. .arrow{
  362. width: 13upx;
  363. height: 23upx;
  364. margin-left: 20upx;
  365. }
  366. }
  367. }
  368. }
  369. }
  370. }
  371. .btn-box {
  372. height: 120upx;
  373. padding: 0 30upx;
  374. display: flex;
  375. align-items: center;
  376. justify-content: center;
  377. margin-top: 86rpx;
  378. // position: fixed;
  379. // width: 90%;
  380. // bottom: 0;
  381. // left: 50%;
  382. // transform: translate(-50%,-50%);
  383. // background: #FFFFFF;
  384. .sub-btn {
  385. width: 100%;
  386. height: 88upx;
  387. line-height: 88upx;
  388. text-align: center;
  389. font-family: PingFang SC, PingFang SC;
  390. font-weight: 400;
  391. font-size: 32rpx;
  392. color: #FFFFFF;
  393. background: #388BFF ;
  394. border-radius: 44upx;
  395. margin-bottom: 40upx;
  396. display: flex;
  397. align-items: center;
  398. justify-content: center;
  399. image{
  400. margin-right: 16rpx;
  401. }
  402. }
  403. }
  404. }
  405. </style>