Showing
2 changed files
with
64 additions
and
21 deletions
src/api/Partner/index.js
0 → 100644
| 1 | +/* | ||
| 2 | + * @Date: 2022-10-20 13:15:00 | ||
| 3 | + * @LastEditors: hookehuyr hookehuyr@gmail.com | ||
| 4 | + * @LastEditTime: 2022-10-24 11:00:14 | ||
| 5 | + * @FilePath: /swx/src/api/Partner/index.js | ||
| 6 | + * @Description: 陪伴用户 | ||
| 7 | + */ | ||
| 8 | +import { fn, fetch } from '../fn'; | ||
| 9 | + | ||
| 10 | +const Api = { | ||
| 11 | + ADD_PARTNER: '/srv/?a=partner_add', | ||
| 12 | +} | ||
| 13 | + | ||
| 14 | +/** | ||
| 15 | + * @description: 新增陪伴记录 | ||
| 16 | + * @returns | ||
| 17 | + */ | ||
| 18 | +export const addPartnerAPI = (params) => fn(fetch.post(Api.ADD_PARTNER, params)); |
| 1 | <!-- | 1 | <!-- |
| 2 | * @Date: 2022-09-30 09:53:14 | 2 | * @Date: 2022-09-30 09:53:14 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2022-09-30 11:50:17 | 4 | + * @LastEditTime: 2022-10-24 16:44:07 |
| 5 | * @FilePath: /swx/src/pages/addRecord/index.vue | 5 | * @FilePath: /swx/src/pages/addRecord/index.vue |
| 6 | * @Description: 文件描述 | 6 | * @Description: 文件描述 |
| 7 | --> | 7 | --> |
| ... | @@ -27,7 +27,7 @@ | ... | @@ -27,7 +27,7 @@ |
| 27 | <view style="margin-right: 0; margin-top: 0.5rem;"><van-icon :name="icon_sel" color="" /></view> | 27 | <view style="margin-right: 0; margin-top: 0.5rem;"><van-icon :name="icon_sel" color="" /></view> |
| 28 | </view> | 28 | </view> |
| 29 | </view> | 29 | </view> |
| 30 | - <van-field :value="message" label-class="label-class" input-class="input-class" label="跟进内容" type="textarea" | 30 | + <van-field :value="note" label-class="label-class" input-class="input-class" label="跟进内容" type="textarea" |
| 31 | placeholder="请输入跟进记录详情" placeholder-style="color: #CCC; font-size: 1.05rem;" :autosize="{ maxHeight: 300, minHeight: 150 }" customStyle="" inputAlign="" | 31 | placeholder="请输入跟进记录详情" placeholder-style="color: #CCC; font-size: 1.05rem;" :autosize="{ maxHeight: 300, minHeight: 150 }" customStyle="" inputAlign="" |
| 32 | rightIcon="" :required="false" :border="false" @change="onChange" /> | 32 | rightIcon="" :required="false" :border="false" @change="onChange" /> |
| 33 | </view> | 33 | </view> |
| ... | @@ -35,39 +35,61 @@ | ... | @@ -35,39 +35,61 @@ |
| 35 | <bottom-button @on-submit="onSubmit">保存</bottom-button> | 35 | <bottom-button @on-submit="onSubmit">保存</bottom-button> |
| 36 | 36 | ||
| 37 | <!-- 陪伴状态弹出框 --> | 37 | <!-- 陪伴状态弹出框 --> |
| 38 | - <van-popup :show="show_popup" position="bottom" custom-style="height: 40%;" :lock-scroll="true"> | 38 | + <van-popup :show="show_popup" position="bottom" custom-style="height: 50%;" :lock-scroll="true"> |
| 39 | <van-picker :show-toolbar="true" title="" confirm-button-text="确定" :columns="columns" toolbar-class="picker-toolbar" | 39 | <van-picker :show-toolbar="true" title="" confirm-button-text="确定" :columns="columns" toolbar-class="picker-toolbar" |
| 40 | - @confirm="onConfirm" @cancel="onCancel" @change="onChange" /> | 40 | + @confirm="onConfirm" @cancel="onCancel" /> |
| 41 | </van-popup> | 41 | </van-popup> |
| 42 | + | ||
| 43 | + <van-toast id="van-toast" /> | ||
| 44 | + | ||
| 42 | </template> | 45 | </template> |
| 43 | 46 | ||
| 44 | <script setup> | 47 | <script setup> |
| 45 | -import { ref } from "vue"; | 48 | +import { ref, onMounted } from "vue"; |
| 46 | - | ||
| 47 | import icon_sel from '@/images/icon/sel@2x.png' | 49 | import icon_sel from '@/images/icon/sel@2x.png' |
| 48 | import bottomButton from "@/components/bottom-button"; | 50 | import bottomButton from "@/components/bottom-button"; |
| 49 | import Taro from '@tarojs/taro' | 51 | import Taro from '@tarojs/taro' |
| 52 | +import { hostInfoAPI } from '@/api/Host/index'; | ||
| 53 | +import { getCurrentPageParam } from "@/utils/weapp"; | ||
| 54 | +import { DEFAULT_HOST_STATUS } from '@/utils/sysData' | ||
| 55 | +import { addPartnerAPI } from '@/api/Partner/index'; | ||
| 56 | +import Toast from '@/components/vant-weapp/toast/toast'; | ||
| 50 | 57 | ||
| 51 | -const username = ref('精妙'); | 58 | +const username = JSON.parse(getCurrentPageParam().name); |
| 52 | -const message = ref(''); | 59 | +const columns = ref(DEFAULT_HOST_STATUS); |
| 60 | +onMounted(async () => { | ||
| 61 | + const { code, data } = await hostInfoAPI({ i: getCurrentPageParam().host_id }); | ||
| 62 | + if (code) { | ||
| 63 | + columns.value = columns.value.concat(data.user_status); | ||
| 64 | + } | ||
| 65 | +}); | ||
| 53 | 66 | ||
| 54 | -const onSubmit = (val) => { | 67 | +const onSubmit = async () => { |
| 55 | - console.warn(val); | 68 | + if (!user_status.value) { |
| 56 | - Taro.showToast({ | 69 | + Toast.fail('陪伴状态为空'); |
| 57 | - title: '请检查输入项', | 70 | + return false; |
| 58 | - icon: 'error', | 71 | + } |
| 59 | - duration: 2000 | 72 | + if (!note.value) { |
| 60 | - }); | 73 | + Toast.fail('跟进内容为空'); |
| 61 | - Taro.redirectTo({ | 74 | + return false; |
| 62 | - url: '../joinSuccess/index' | 75 | + } |
| 63 | - }) | 76 | + const params = { |
| 77 | + member_id: getCurrentPageParam().id, | ||
| 78 | + status: user_status.value, | ||
| 79 | + note: note.value | ||
| 80 | + } | ||
| 81 | + const { code, data } = await addPartnerAPI(params); | ||
| 82 | + if (code) { | ||
| 83 | + Toast.success('添加成功'); | ||
| 84 | + Taro.navigateBack(); | ||
| 85 | + } | ||
| 64 | } | 86 | } |
| 65 | 87 | ||
| 66 | const show_popup = ref(false); | 88 | const show_popup = ref(false); |
| 67 | const user_status = ref(''); | 89 | const user_status = ref(''); |
| 68 | -const columns = ref(['跟进', '引导']); | 90 | +const note = ref(''); |
| 69 | const onChange = (event) => { | 91 | const onChange = (event) => { |
| 70 | - const { picker, value, index } = event.detail; | 92 | + note.value = event.detail; |
| 71 | } | 93 | } |
| 72 | const onConfirm = (event) => { | 94 | const onConfirm = (event) => { |
| 73 | const { picker, value, index } = event.detail; | 95 | const { picker, value, index } = event.detail; |
| ... | @@ -81,7 +103,10 @@ const onCancel = (event) => { | ... | @@ -81,7 +103,10 @@ const onCancel = (event) => { |
| 81 | 103 | ||
| 82 | <script> | 104 | <script> |
| 83 | import "./index.less"; | 105 | import "./index.less"; |
| 106 | +import mixin from '@/utils/mixin'; | ||
| 107 | + | ||
| 84 | export default { | 108 | export default { |
| 85 | - name: "demoPage", | 109 | + name: "addRecordPage", |
| 110 | + mixins: [mixin.init], | ||
| 86 | }; | 111 | }; |
| 87 | </script> | 112 | </script> | ... | ... |
-
Please register or login to post a comment