addCompetitors.vue 7.9 KB

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