| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- <template>
- <view class="follow_wrap">
- <u-navbar placeholder :autoBack="true" title="添加跟进记录" @rightClick="handleNavSaveClick">
- <view class="u-nav-slot" slot="right">
- 保存
- </view>
- </u-navbar>
- <view class="form_wrap">
- <u--form labelPosition="left" labelWidth="80" :model="form" :rules="rules" ref="form" class="form_wrap">
- <u-form-item label="跟进内容" prop="content">
- <u--textarea v-model="form.content" placeholder="请输入内容" count confirmType="done" maxlength="500">
- </u--textarea>
- </u-form-item>
- </u--form>
- </view>
- <!-- <drag-button :isDock="true" /> -->
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- rules: {
- 'content': {
- type: 'string',
- required: true,
- message: '请输入内容',
- trigger: ['blur', 'change']
- },
- },
- form: {
- clueId : undefined,
- orderId: undefined,
- content: '',
- type: 'clue' // 标识当前模式:clue 或 order
- },
- }
- },
- methods: {
- handleNavSaveClick() {
- this.$refs.form.validate().then(async () => {
- if (this.form.type === 'order') {
- // 订单跟进,调用 addOrderFollow 接口
- const orderFormData = {
- orderId: this.form.orderId,
- content: this.form.content
- };
- await uni.$u.api.addOrderFollow(orderFormData);
- } else {
- // 线索跟进,调用 addClueFollow 接口
- const clueFormData = {
- clueId: this.form.clueId,
- content: this.form.content
- };
- await uni.$u.api.addClueFollow(clueFormData);
- }
- uni.$u.toast("保存成功");
- this.timer = setTimeout(()=>{
- uni.$emit('addFollowSuccess', this.form.type);
- uni.navigateBack();
- clearTimeout(this.timer);
- },1000)
- })
- },
- },
- onLoad(option) {
- if (option.orderId) {
- // 订单跟进模式
- this.form.orderId = option.orderId;
- this.form.type = 'order';
- } else if (option.clueId) {
- // 线索跟进模式
- this.form.clueId = option.clueId;
- this.form.type = 'clue';
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .form_wrap {
- background-color: #fff;
- margin: 20rpx 0;
- .form_wrap {
- ::v-deep .u-form-item__body {
- padding: 20rpx 40rpx;
- }
- }
- }
- </style>
|