contactAdd.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. <template>
  2. <view class="mainBox">
  3. <uni-nav-bar background-color="#157A2C" color="#fff" fixed="true" statusBar="true" left-icon="back" title="联系人信息"
  4. @clickLeft="back">
  5. </uni-nav-bar>
  6. <u-cell-group>
  7. <u-cell title="姓名" arrow-direction="down">
  8. <u--input slot="value" placeholder="请输入" border="surround" v-model="form.contactName"></u--input>
  9. </u-cell>
  10. <u-cell title="手机" arrow-direction="down">
  11. <u--input slot="value" placeholder="请输入" border="surround" v-model="form.contactPhone"></u--input>
  12. </u-cell>
  13. <u-cell title="电话" arrow-direction="down">
  14. <u--input slot="value" placeholder="请输入" border="surround" v-model="form.telephone"></u--input>
  15. </u-cell>
  16. <u-cell title="微信号" arrow-direction="down">
  17. <u--input slot="value" placeholder="请输入" border="surround" v-model="form.wechat"></u--input>
  18. </u-cell>
  19. <u-cell title="邮箱" arrow-direction="down">
  20. <u--input slot="value" placeholder="请输入" border="surround" v-model="form.email"></u--input>
  21. </u-cell>
  22. <u-cell title="部门" arrow-direction="down">
  23. <u--input slot="value" placeholder="请输入" border="surround" v-model="form.deptName"></u--input>
  24. </u-cell>
  25. <u-cell title="职务" arrow-direction="down">
  26. <u--input slot="value" placeholder="请输入" border="surround" v-model="form.post"></u--input>
  27. </u-cell>
  28. <u-cell title="备注" arrow-direction="down">
  29. <u--input slot="value" placeholder="请输入" border="surround" v-model="form.remark"></u--input>
  30. </u-cell>
  31. <view class="footerButton">
  32. <u-button type="default" text="返回" @click="back"></u-button>
  33. <u-button type="primary" @click="save" text="保存"></u-button>
  34. </view>
  35. </u-cell-group>
  36. <u-toast ref="uToast"></u-toast>
  37. </view>
  38. </template>
  39. <script>
  40. export default {
  41. components: {},
  42. data() {
  43. return {
  44. form: {
  45. contactName: '',
  46. contactPhone: '',
  47. telephone: '',
  48. wechat: '',
  49. email: '',
  50. deptName: '',
  51. post: '',
  52. remark: '',
  53. },
  54. type: '',
  55. infoIdx:'',
  56. }
  57. },
  58. async onLoad(data) {
  59. this.infoIdx = data.index;
  60. this.type = data.type
  61. if (data.data) {
  62. this.form = JSON.parse(data.data)
  63. }
  64. },
  65. methods: {
  66. save() {
  67. if (!this.form.contactName) {
  68. this.$refs.uToast.show({
  69. type: "warning",
  70. message: "姓名不能为空",
  71. })
  72. return
  73. }
  74. uni.$emit('updateContactList', {
  75. data: this.form,
  76. type: this.type,
  77. index:this.infoIdx
  78. })
  79. this.back()
  80. },
  81. }
  82. }
  83. </script>
  84. <style lang="scss" scoped>
  85. /deep/.u-cell__body__content {
  86. flex: none;
  87. margin-right: 16rpx;
  88. }
  89. .mainBox {
  90. padding-bottom: 84rpx;
  91. }
  92. .footerButton {
  93. width: 100%;
  94. height: 84rpx;
  95. display: flex;
  96. position: fixed;
  97. bottom: 0;
  98. /deep/.u-button {
  99. height: 100%;
  100. }
  101. >view {
  102. flex: 1;
  103. }
  104. }
  105. // /deep/.u-button {
  106. // height: 100%;
  107. // }
  108. /deep/.u-subsection__item__text {
  109. font-size: 28rpx !important;
  110. }
  111. </style>