| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277 |
- <!--
- * @Author: liuzhenlin 461480418@qq.ocm
- * @Date: 2023-01-12 11:57:48
- * @LastEditors: liuzhenlin
- * @LastEditTime: 2023-03-22 10:41:11
- * @Description: file content
- * @FilePath: \oms\pages\publicPages\concatCreate.vue
- -->
- <template>
- <view class="home">
- <view class="nav">
- <view :style="{ paddingTop }">
- <view class="title" :style="[{ height }, { lineHeight: height }]">
- <view class="back" @click="goBack()">
- <u-icon name="arrow-left" color="#ffffff" size="22"></u-icon>
- </view>
- <text>新建联系人</text>
- </view>
- </view>
- </view>
- <view class="main">
- <u-form :model="addForm" :rules="rules" ref="addForm" label-width="0">
- <u-form-item prop="cuctName" customStyle="padding:40rpx 0 34rpx" borderBottom>
- <view class="form-label flex_l">
- <view class="label-tag"></view>
- 姓名
- </view>
- <u-input border="none" v-model="addForm.cuctName" placeholder="请输入姓名"></u-input>
- </u-form-item>
- <u-form-item prop="custName" customStyle="padding:40rpx 0 34rpx" borderBottom>
- <view class="form-label flex_l">
- <view class="label-tag"></view>
- 客户名称
- </view>
- <u-input disabled border="none" v-model="addForm.custName" placeholder="请输入客户名称"></u-input>
- </u-form-item>
- <u-form-item prop="telephone" customStyle="padding:40rpx 0 34rpx" borderBottom>
- <view class="form-label flex_l">手机号码</view>
- <u-input border="none" maxlength="11" v-model="addForm.telephone" placeholder="请输入手机号码"></u-input>
- </u-form-item>
- <u-form-item prop="wechat" customStyle="padding:40rpx 0 34rpx" borderBottom>
- <view class="form-label flex_l">微信</view>
- <u-input border="none" v-model="addForm.wechat" placeholder="请输入微信"></u-input>
- </u-form-item>
- <u-form-item prop="email" customStyle="padding:40rpx 0 34rpx" borderBottom>
- <view class="form-label flex_l">邮箱</view>
- <u-input border="none" v-model="addForm.email" placeholder="请输入邮箱"></u-input>
- </u-form-item>
- <u-form-item prop="dept" customStyle="padding:40rpx 0 34rpx" borderBottom>
- <view class="form-label flex_l">部门</view>
- <u-input border="none" v-model="addForm.dept" placeholder="请输入部门"></u-input>
- </u-form-item>
- <u-form-item prop="postion" customStyle="padding:40rpx 0 34rpx" borderBottom>
- <view class="form-label flex_l">
- <view class="label-tag"></view>
- 职务
- </view>
- <u-input border="none" v-model="addForm.postion" placeholder="请输入职务"></u-input>
- </u-form-item>
- <u-form-item prop="officeLocation" customStyle="padding:40rpx 0 34rpx" borderBottom>
- <view class="form-label flex_l">办公地点</view>
- <u-input border="none" v-model="addForm.officeLocation" placeholder="请输入办公地点"></u-input>
- </u-form-item>
- <u-form-item prop="isDecision" customStyle="padding:40rpx 0 34rpx" borderBottom>
- <view class="form-label flex_l">
- <view class="label-tag"></view>
- 是否关键决策人
- </view>
- <u-radio-group v-model="addForm.isDecision" placement="row">
- <u-radio name="10" label="是" customStyle="margin-right:14rpx"></u-radio>
- <u-radio name="20" label="否"></u-radio>
- </u-radio-group>
- </u-form-item>
- <u-form-item prop="isDecision" customStyle="padding:40rpx 0 34rpx" borderBottom>
- <view class="form-label flex_l">
- <view class="label-tag"></view>
- 性别
- </view>
- <u-radio-group v-model="addForm.cuctGender" placement="row">
- <u-radio name="10" label="男" customStyle="margin-right:14rpx"></u-radio>
- <u-radio name="20" label="女"></u-radio>
- </u-radio-group>
- </u-form-item>
- </u-form>
- <view class="center">
- <view class="handle-btn" @click="handleAdd" :class="!flag ? 'disabledBtn' : ''">保存</view>
- </view>
- </view>
- <u-notify ref="uNotify"></u-notify>
- <u-toast ref="uToast"></u-toast>
- </view>
- </template>
- <script>
- import to from 'await-to-js'
- import customerApi from '../../api/customer'
- export default {
- name: 'omsIndex',
- data() {
- return {
- flag:true,
- height: '',
- paddingTop: '',
- addForm: {
- cuctName: '',
- telephone: '',
- wechat: '',
- email: '',
- dept: '',
- postion: '',
- officeLocation: '',
- custId: 0,
- custName: '',
- isDecision: '20', //是否决策人 (10是20否)
- cuctGender: '10', //性别(10男20女)
- },
- rules: {
- cuctName: { required: true, trigger: ['blur'], message: '请输入联系人姓名' },
- custName: { required: true, trigger: ['blur'], message: '请输入客户名称' },
- cuctGender: { required: true, trigger: ['blur'], message: '请输入性别' },
- postion: { required: true, trigger: ['blur'], message: '请输入岗位名称' },
- telephone: [
- {
- validator: (rule, value, callback) => {
- if (value !== '') {
- const reg = /^1[3456789]\d{9}$/
- if (!reg.test(value)) {
- callback(new Error('手机号格式不正确'))
- } else {
- callback()
- }
- } else {
- callback()
- }
- },
- },
- ],
- },
- }
- },
- onLoad(option) {
- this.addForm.custId = Number(option.id)
- this.addForm.custName = option.name
- },
- created() {
- const navData = uni.getMenuButtonBoundingClientRect()
- this.height = navData.height + 'px'
- this.paddingTop = navData.top + 'px'
- },
- mounted() {},
- methods: {
- handleAdd() {
- if(!this.flag) return
- this.$refs.addForm
- .validate()
- .then(async () => {
- let params = this.addForm
- this.flag = false
- const [err, res] = await to(customerApi.createContact(params))
- this.flag = true
- if (err) return
- if (res && res.code == 200) {
- this.$refs.uToast.show({
- type: 'success',
- message: '创建成功',
- complete: () => {
- uni.navigateBack({
- //关闭当前页面,返回上一页面或多级页面。
- delta: 1,
- })
- },
- })
- }
- })
- .catch((err) => {
- this.$refs.uNotify.show({
- top: this.height + this.paddingTop + 10,
- type: 'warning',
- message: err[0].message,
- duration: 1000 * 3,
- })
- })
- },
- goBack() {
- uni.navigateBack({
- //关闭当前页面,返回上一页面或多级页面。
- delta: 1,
- })
- },
- },
- }
- </script>
- <style>
- page {
- background: #f2f3f5;
- }
- </style>
- <style lang="scss" scoped>
- .home {
- padding-top: 188rpx;
- .nav {
- position: absolute;
- left: 0;
- top: 0;
- width: 100%;
- height: 284rpx;
- background: #3e7ef8;
- .title {
- position: relative;
- text-align: center;
- font-size: 32rpx;
- font-weight: bold;
- color: #ffffff;
- .back {
- position: absolute;
- top: 0;
- bottom: 0;
- margin: auto;
- left: 70rpx;
- display: flex;
- }
- }
- }
- .main {
- position: absolute;
- width: 100%;
- height: calc(100vh - 188rpx);
- background: #ffffff;
- box-shadow: 0 6rpx 19rpx 2rpx rgba(0, 45, 132, 0.15);
- border-radius: 31rpx 31rpx 0 0;
- padding: 0 32rpx;
- overflow: auto;
- padding-bottom: 64rpx;
- .form-label {
- font-size: 32rpx;
- font-weight: bold;
- color: #323232;
- padding-bottom: 18rpx;
- .label-tag {
- width: 15rpx;
- height: 15rpx;
- background: #ff4d4f;
- border-radius: 50%;
- margin-right: 10rpx;
- }
- }
- .upload-file-box {
- padding: 20rpx 0;
- position: relative;
- .upload-btn {
- position: absolute;
- right: 0;
- top: 26rpx;
- }
- }
- }
- .handle-btn {
- width: 569rpx;
- height: 92rpx;
- background: #3e7ef8;
- border-radius: 31rpx;
- margin: 116rpx auto 0;
- font-size: 32rpx;
- color: #ffffff;
- text-align: center;
- line-height: 92rpx;
- }
- }
- </style>
|