concatCreate.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  1. <!--
  2. * @Author: liuzhenlin 461480418@qq.ocm
  3. * @Date: 2023-01-12 11:57:48
  4. * @LastEditors: liuzhenlin
  5. * @LastEditTime: 2023-03-22 10:41:11
  6. * @Description: file content
  7. * @FilePath: \oms\pages\publicPages\concatCreate.vue
  8. -->
  9. <template>
  10. <view class="home">
  11. <view class="nav">
  12. <view :style="{ paddingTop }">
  13. <view class="title" :style="[{ height }, { lineHeight: height }]">
  14. <view class="back" @click="goBack()">
  15. <u-icon name="arrow-left" color="#ffffff" size="22"></u-icon>
  16. </view>
  17. <text>新建联系人</text>
  18. </view>
  19. </view>
  20. </view>
  21. <view class="main">
  22. <u-form :model="addForm" :rules="rules" ref="addForm" label-width="0">
  23. <u-form-item prop="cuctName" customStyle="padding:40rpx 0 34rpx" borderBottom>
  24. <view class="form-label flex_l">
  25. <view class="label-tag"></view>
  26. 姓名
  27. </view>
  28. <u-input border="none" v-model="addForm.cuctName" placeholder="请输入姓名"></u-input>
  29. </u-form-item>
  30. <u-form-item prop="custName" customStyle="padding:40rpx 0 34rpx" borderBottom>
  31. <view class="form-label flex_l">
  32. <view class="label-tag"></view>
  33. 客户名称
  34. </view>
  35. <u-input disabled border="none" v-model="addForm.custName" placeholder="请输入客户名称"></u-input>
  36. </u-form-item>
  37. <u-form-item prop="telephone" customStyle="padding:40rpx 0 34rpx" borderBottom>
  38. <view class="form-label flex_l">手机号码</view>
  39. <u-input border="none" maxlength="11" v-model="addForm.telephone" placeholder="请输入手机号码"></u-input>
  40. </u-form-item>
  41. <u-form-item prop="wechat" customStyle="padding:40rpx 0 34rpx" borderBottom>
  42. <view class="form-label flex_l">微信</view>
  43. <u-input border="none" v-model="addForm.wechat" placeholder="请输入微信"></u-input>
  44. </u-form-item>
  45. <u-form-item prop="email" customStyle="padding:40rpx 0 34rpx" borderBottom>
  46. <view class="form-label flex_l">邮箱</view>
  47. <u-input border="none" v-model="addForm.email" placeholder="请输入邮箱"></u-input>
  48. </u-form-item>
  49. <u-form-item prop="dept" customStyle="padding:40rpx 0 34rpx" borderBottom>
  50. <view class="form-label flex_l">部门</view>
  51. <u-input border="none" v-model="addForm.dept" placeholder="请输入部门"></u-input>
  52. </u-form-item>
  53. <u-form-item prop="postion" customStyle="padding:40rpx 0 34rpx" borderBottom>
  54. <view class="form-label flex_l">
  55. <view class="label-tag"></view>
  56. 职务
  57. </view>
  58. <u-input border="none" v-model="addForm.postion" placeholder="请输入职务"></u-input>
  59. </u-form-item>
  60. <u-form-item prop="officeLocation" customStyle="padding:40rpx 0 34rpx" borderBottom>
  61. <view class="form-label flex_l">办公地点</view>
  62. <u-input border="none" v-model="addForm.officeLocation" placeholder="请输入办公地点"></u-input>
  63. </u-form-item>
  64. <u-form-item prop="isDecision" customStyle="padding:40rpx 0 34rpx" borderBottom>
  65. <view class="form-label flex_l">
  66. <view class="label-tag"></view>
  67. 是否关键决策人
  68. </view>
  69. <u-radio-group v-model="addForm.isDecision" placement="row">
  70. <u-radio name="10" label="是" customStyle="margin-right:14rpx"></u-radio>
  71. <u-radio name="20" label="否"></u-radio>
  72. </u-radio-group>
  73. </u-form-item>
  74. <u-form-item prop="isDecision" customStyle="padding:40rpx 0 34rpx" borderBottom>
  75. <view class="form-label flex_l">
  76. <view class="label-tag"></view>
  77. 性别
  78. </view>
  79. <u-radio-group v-model="addForm.cuctGender" placement="row">
  80. <u-radio name="10" label="男" customStyle="margin-right:14rpx"></u-radio>
  81. <u-radio name="20" label="女"></u-radio>
  82. </u-radio-group>
  83. </u-form-item>
  84. </u-form>
  85. <view class="center">
  86. <view class="handle-btn" @click="handleAdd">保存</view>
  87. </view>
  88. </view>
  89. <u-notify ref="uNotify"></u-notify>
  90. <u-toast ref="uToast"></u-toast>
  91. </view>
  92. </template>
  93. <script>
  94. import to from 'await-to-js'
  95. import customerApi from '../../api/customer'
  96. export default {
  97. name: 'omsIndex',
  98. data() {
  99. return {
  100. height: '',
  101. paddingTop: '',
  102. addForm: {
  103. cuctName: '',
  104. telephone: '',
  105. wechat: '',
  106. email: '',
  107. dept: '',
  108. postion: '',
  109. officeLocation: '',
  110. custId: 0,
  111. custName: '',
  112. isDecision: '20', //是否决策人 (10是20否)
  113. cuctGender: '10', //性别(10男20女)
  114. },
  115. rules: {
  116. cuctName: { required: true, trigger: ['blur'], message: '请输入联系人姓名' },
  117. custName: { required: true, trigger: ['blur'], message: '请输入客户名称' },
  118. cuctGender: { required: true, trigger: ['blur'], message: '请输入性别' },
  119. postion: { required: true, trigger: ['blur'], message: '请输入岗位名称' },
  120. telephone: [
  121. {
  122. validator: (rule, value, callback) => {
  123. if (value !== '') {
  124. const reg = /^1[3456789]\d{9}$/
  125. if (!reg.test(value)) {
  126. callback(new Error('手机号格式不正确'))
  127. } else {
  128. callback()
  129. }
  130. } else {
  131. callback()
  132. }
  133. },
  134. },
  135. ],
  136. },
  137. }
  138. },
  139. onLoad(option) {
  140. this.addForm.custId = Number(option.id)
  141. this.addForm.custName = option.name
  142. },
  143. created() {
  144. const navData = uni.getMenuButtonBoundingClientRect()
  145. this.height = navData.height + 'px'
  146. this.paddingTop = navData.top + 'px'
  147. },
  148. mounted() {},
  149. methods: {
  150. handleAdd() {
  151. this.$refs.addForm
  152. .validate()
  153. .then(async () => {
  154. let params = this.addForm
  155. const [err, res] = await to(customerApi.createContact(params))
  156. if (err) return
  157. if (res && res.code == 200) {
  158. this.$refs.uToast.show({
  159. type: 'success',
  160. message: '创建成功',
  161. complete: () => {
  162. uni.navigateBack({
  163. //关闭当前页面,返回上一页面或多级页面。
  164. delta: 1,
  165. })
  166. },
  167. })
  168. }
  169. })
  170. .catch((err) => {
  171. this.$refs.uNotify.show({
  172. top: this.height + this.paddingTop + 10,
  173. type: 'warning',
  174. message: err[0].message,
  175. duration: 1000 * 3,
  176. })
  177. })
  178. },
  179. goBack() {
  180. uni.navigateBack({
  181. //关闭当前页面,返回上一页面或多级页面。
  182. delta: 1,
  183. })
  184. },
  185. },
  186. }
  187. </script>
  188. <style>
  189. page {
  190. background: #f2f3f5;
  191. }
  192. </style>
  193. <style lang="scss" scoped>
  194. .home {
  195. padding-top: 188rpx;
  196. .nav {
  197. position: absolute;
  198. left: 0;
  199. top: 0;
  200. width: 100%;
  201. height: 284rpx;
  202. background: #3e7ef8;
  203. .title {
  204. position: relative;
  205. text-align: center;
  206. font-size: 32rpx;
  207. font-weight: bold;
  208. color: #ffffff;
  209. .back {
  210. position: absolute;
  211. top: 0;
  212. bottom: 0;
  213. margin: auto;
  214. left: 70rpx;
  215. display: flex;
  216. }
  217. }
  218. }
  219. .main {
  220. position: absolute;
  221. width: 100%;
  222. height: calc(100vh - 188rpx);
  223. background: #ffffff;
  224. box-shadow: 0 6rpx 19rpx 2rpx rgba(0, 45, 132, 0.15);
  225. border-radius: 31rpx 31rpx 0 0;
  226. padding: 0 32rpx;
  227. overflow: auto;
  228. padding-bottom: 64rpx;
  229. .form-label {
  230. font-size: 32rpx;
  231. font-weight: bold;
  232. color: #323232;
  233. padding-bottom: 18rpx;
  234. .label-tag {
  235. width: 15rpx;
  236. height: 15rpx;
  237. background: #ff4d4f;
  238. border-radius: 50%;
  239. margin-right: 10rpx;
  240. }
  241. }
  242. .upload-file-box {
  243. padding: 20rpx 0;
  244. position: relative;
  245. .upload-btn {
  246. position: absolute;
  247. right: 0;
  248. top: 26rpx;
  249. }
  250. }
  251. }
  252. .handle-btn {
  253. width: 569rpx;
  254. height: 92rpx;
  255. background: #3e7ef8;
  256. border-radius: 31rpx;
  257. margin: 116rpx auto 0;
  258. font-size: 32rpx;
  259. color: #ffffff;
  260. text-align: center;
  261. line-height: 92rpx;
  262. }
  263. }
  264. </style>