addCompetitors.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411
  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>
  7. <input class="input-width" type="text" v-model="form.userName" placeholder="请输入竞品公司"
  8. placeholder-class="form-input" />
  9. </view>
  10. <view class="form-item">
  11. <text class="label">产品</text>
  12. <input class="input-width" type="text" v-model="form.userName" placeholder="请输入产品"
  13. placeholder-class="form-input" />
  14. </view>
  15. <view class="form-item">
  16. <text class="label">价格</text>
  17. <input class="input-width" type="text" v-model="form.userName" placeholder="请输入价格"
  18. placeholder-class="form-input" />
  19. </view>
  20. <view class="form-item">
  21. <text class="label">服务</text>
  22. <input class="input-width" type="text" v-model="form.userName" placeholder="请输入竞品公司服务方式"
  23. placeholder-class="form-input" />
  24. </view>
  25. <view class="form-item">
  26. <text class="label">免费服务次数</text>
  27. <input class="input-width" type="text" v-model="form.userName" placeholder="请输入服务次数"
  28. placeholder-class="form-input" />
  29. </view>
  30. </view>
  31. </view>
  32. <view class="btn-box">
  33. <view class="sub-btn" @click="submit()">
  34. <image src="/static/images/health/nav_add_icon24.png" class="w48 h48"></image>
  35. <text>新增竞品信息</text>
  36. </view>
  37. </view>
  38. </view>
  39. </template>
  40. <script>
  41. import {
  42. getDocDetails,
  43. addDoc,
  44. editDoc
  45. } from '@/api/doc.js'
  46. export default {
  47. data() {
  48. return {
  49. type: null,
  50. patientId: null,
  51. famaleurl:"/static/images/health/female_profile.png",
  52. maleurl:"/static/images/health/my_heads.png",
  53. checked:1,
  54. array:['是','否'],
  55. tags: [{
  56. name: '心脏病',
  57. checked:true,
  58. id: 1
  59. },
  60. {
  61. name: '脑梗死',
  62. checked:false,
  63. id: 2
  64. },{
  65. name: '肾病',
  66. checked:false,
  67. id: 3
  68. },{
  69. name: '脂肪肝',
  70. checked:false,
  71. id: 4
  72. }],
  73. form: {
  74. userName: null,
  75. idCard: null,
  76. sex: null,
  77. birthday: null,
  78. remark: null,
  79. }
  80. };
  81. },
  82. onLoad(option) {
  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. sexChange(type) {
  92. this.form.sex = type
  93. },
  94. radioClick(item) {
  95. this.checked=item.id
  96. },
  97. getDocDetails() {
  98. var data = {
  99. docId: this.docId
  100. };
  101. getDocDetails(data).then(
  102. res => {
  103. if (res.code == 200) {
  104. this.form = res.data;
  105. } else {
  106. uni.showToast({
  107. title: res.msg,
  108. });
  109. }
  110. },
  111. rej => {}
  112. );
  113. },
  114. onChooseAvatar(e){
  115. let {
  116. avatarUrl
  117. } = e.detail;
  118. uni.uploadFile({
  119. url: uni.getStorageSync('requestPath')+'/app/common/uploadOSS', //仅为示例,非真实的接口地址
  120. filePath: avatarUrl,
  121. name: 'file',
  122. formData: {
  123. 'user': 'test' // 上传附带参数
  124. },
  125. success: (uploadFileRes) => {
  126. this.user.avatar =JSON.parse(uploadFileRes.data).url
  127. }
  128. });
  129. },
  130. submit() {
  131. // if (this.form.userName == null) {
  132. // uni.showToast({
  133. // icon: 'none',
  134. // title: "姓名不能为空",
  135. // });
  136. // return;
  137. // }
  138. // if (this.form.idCard == null) {
  139. // uni.showToast({
  140. // icon: 'none',
  141. // title: "身份证号不能为空",
  142. // });
  143. // return;
  144. // }
  145. // if (this.form.sex == null) {
  146. // uni.showToast({
  147. // icon: 'none',
  148. // title: "性别不能为空",
  149. // });
  150. // return;
  151. // }
  152. // if (this.form.birthday == null) {
  153. // uni.showToast({
  154. // icon: 'none',
  155. // title: "出生年月不能为空",
  156. // });
  157. // return;
  158. // }
  159. // if (this.type == "add") {
  160. // this.addDoc()
  161. // } else if (this.type == "edit") {
  162. // this.editDoc()
  163. // }
  164. uni.navigateTo({
  165. url: '/pages_health/doc?type=edit&docId='
  166. })
  167. },
  168. editDoc() {
  169. editDoc(this.form).then(
  170. res => {
  171. if (res.code == 200) {
  172. uni.showToast({
  173. icon: 'success',
  174. title: "操作成功",
  175. });
  176. setTimeout(function() {
  177. uni.$emit('refreshDoc');
  178. uni.navigateBack({
  179. delta: 1
  180. })
  181. }, 500);
  182. } else {
  183. uni.showToast({
  184. icon: 'none',
  185. title: res.msg,
  186. });
  187. }
  188. },
  189. rej => {}
  190. );
  191. },
  192. addDoc() {
  193. addDoc(this.form).then(
  194. res => {
  195. if (res.code == 200) {
  196. uni.showToast({
  197. icon: 'success',
  198. title: "操作成功",
  199. });
  200. setTimeout(function() {
  201. uni.$emit('refreshDoc');
  202. uni.navigateBack({
  203. delta: 1
  204. })
  205. }, 500);
  206. } else {
  207. uni.showToast({
  208. icon: 'none',
  209. title: res.msg,
  210. });
  211. }
  212. },
  213. rej => {}
  214. );
  215. },
  216. // 出生日期选择
  217. bindDateChange: function(e) {
  218. this.form.birthday = e.target.value
  219. },
  220. }
  221. }
  222. </script>
  223. <style lang="scss">
  224. page {
  225. height: 100%;
  226. }
  227. .content {
  228. height: 100%;
  229. display: flex;
  230. flex-direction: column;
  231. justify-content: space-between;
  232. .inner {
  233. // height: calc(100% - 120upx);
  234. padding: 20upx;
  235. .form-box {
  236. padding: 0 30upx;
  237. background: #FFFFFF;
  238. border-radius: 16upx;
  239. margin-bottom: 20upx;
  240. .form-title {
  241. font-family: PingFang SC;
  242. font-weight: 600;
  243. font-size: 40rpx;
  244. color: #222426;
  245. text-align: left;
  246. padding: 30rpx 0;
  247. display: block;
  248. }
  249. .form-item {
  250. padding: 30upx 0;
  251. display: flex;
  252. align-items: flex-start;
  253. border-bottom: 1px solid #F1F1F1;
  254. &:last-child {
  255. border-bottom: none;
  256. }
  257. .label {
  258. width: 300upx;
  259. text-align: left;
  260. font-size: 32upx;
  261. line-height: 44upx;
  262. font-family: PingFang SC;
  263. font-weight: 500;
  264. color: #222222;
  265. flex-shrink: 0;
  266. }
  267. input {
  268. text-align: right;
  269. }
  270. .form-input {
  271. font-size: 30upx;
  272. font-family: PingFang SC;
  273. font-weight: 500;
  274. color: #999999;
  275. text-align: right;
  276. }
  277. .form-item-tag{
  278. margin-right: 16rpx;
  279. .tag{
  280. border-radius: 8rpx 8rpx 8rpx 8rpx;
  281. border: 2rpx solid #ECECEC;
  282. display: flex;
  283. align-items: center;
  284. padding: 24rpx;
  285. font-family: PingFang SC;
  286. font-weight: 400;
  287. font-size: 24rpx;
  288. &.active{
  289. background: #F0FAFF;
  290. border: 2rpx solid #008FD3;
  291. color: #008FD3;
  292. }
  293. }
  294. }
  295. .right{
  296. display: flex;
  297. align-items: center;
  298. }
  299. .sex-box{
  300. flex:1;
  301. display: flex;
  302. align-items: center;
  303. justify-content: flex-end;
  304. .sex-item{
  305. width: 146rpx;
  306. height: 64rpx;
  307. display: flex;
  308. align-items: center;
  309. justify-content: center;
  310. background: #F5F7FA;
  311. border-radius: 32rpx 32rpx 32rpx 32rpx;
  312. margin-left: 16rpx;
  313. .u-icon__icon{
  314. margin: 0;
  315. }
  316. text{
  317. // font-family: PingFang SC, PingFang SC;
  318. font-weight: 400;
  319. font-size: 28rpx;
  320. color: #898E91;
  321. margin-left: 12rpx;
  322. }
  323. &.active{
  324. background: #FCF0E7;
  325. text{
  326. color:#FF5030
  327. }
  328. }
  329. }
  330. }
  331. .form-textarea{
  332. font-size: 30upx;
  333. color: #999999;
  334. height: 100upx;
  335. padding: 4upx 0;
  336. }
  337. .birth-picker {
  338. flex: 1;
  339. display: flex;
  340. align-items: center;
  341. .right-box{
  342. width: 100%;
  343. display: flex;
  344. align-items: center;
  345. .input-box{
  346. // width: 470upx;
  347. }
  348. .arrow{
  349. width: 13upx;
  350. height: 23upx;
  351. margin-left: 20upx;
  352. }
  353. }
  354. }
  355. }
  356. }
  357. }
  358. .btn-box {
  359. height: 120upx;
  360. padding: 0 30upx;
  361. display: flex;
  362. align-items: center;
  363. justify-content: center;
  364. // position: fixed;
  365. // width: 90%;
  366. // bottom: 0;
  367. // left: 50%;
  368. // transform: translate(-50%,-50%);
  369. // background: #FFFFFF;
  370. .sub-btn {
  371. width: 100%;
  372. height: 88upx;
  373. line-height: 88upx;
  374. text-align: center;
  375. font-size: 32upx;
  376. font-family: PingFang SC;
  377. font-weight: bold;
  378. color: #FFFFFF;
  379. background: #008FD3 ;
  380. border-radius: 44upx;
  381. margin-bottom: 40upx;
  382. display: flex;
  383. align-items: center;
  384. justify-content: center;
  385. image{
  386. margin-right: 16rpx;
  387. }
  388. }
  389. }
  390. }
  391. </style>