| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215 |
- <!--
- * @Author: liuzhenlin 461480418@qq.ocm
- * @Date: 2023-01-12 11:57:48
- * @LastEditors: liuzhenlin
- * @LastEditTime: 2023-02-17 14:33:19
- * @Description: file content
- * @FilePath: \oms\pages\project\transfer.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="transferObj" :rules="rules" ref="addForm" label-width="0">
- <u-form-item prop="userName" borderBottom customStyle="padding:40rpx 0 30rpx" @click="$refs.user.open()">
- <view class="form-label flex_l">
- <view class="label-tag"></view>
- 接收对象
- </view>
- <u-input
- v-model="transferObj.userName"
- disabled
- disabledColor="#ffffff"
- placeholder="请选择接收对象"
- border="none"></u-input>
- <u-icon slot="right" name="arrow-right"></u-icon>
- </u-form-item>
- <u-form-item prop="remark" customStyle="padding:40rpx 0 30rpx">
- <view class="form-label flex_l">
- <view class="label-tag"></view>
- 转移原因
- </view>
- <u-textarea
- fontSize="26rpx"
- v-model="transferObj.remark"
- placeholder="请输入转移原因"
- height="180"
- :count="true"
- maxlength="300"></u-textarea>
- </u-form-item>
- </u-form>
- <view class="save" @click="handleAdd">保存</view>
- </view>
- <u-notify ref="uNotify"></u-notify>
- <u-toast ref="uToast"></u-toast>
- <select-user ref="user" @close="closeUser()"></select-user>
- </view>
- </template>
- <script>
- import projectApi from '../../api/project'
- import SelectUser from '../../components/SelectUser'
- import to from 'await-to-js'
- export default {
- name: 'omsIndex',
- components: { SelectUser },
- data() {
- return {
- height: '',
- paddingTop: '',
- transferObj: {
- remark: '',
- userId: null, //接收对象id
- userName: '', //接收对象name
- id: 0, //客户id
- },
- rules: {
- userName: {
- type: 'string',
- required: true,
- message: '请选择转移对象',
- trigger: ['blur'],
- },
- remark: {
- type: 'string',
- required: true,
- message: '请输入转移原因',
- trigger: ['blur', 'change'],
- },
- },
- }
- },
- created() {
- const navData = uni.getMenuButtonBoundingClientRect()
- this.height = navData.height + 'px'
- this.paddingTop = navData.top + 'px'
- },
- onLoad(option) {
- console.log(option.id) //打印出上个页面传递的参数。
- this.transferObj.id = parseInt(option.id)
- },
- onShow() {},
- methods: {
- handleAdd() {
- this.$refs.addForm
- .validate()
- .then(async () => {
- console.log(1111)
- let params = this.transferObj
- console.log(params)
- const [err, res] = await to(projectApi.transfer(params))
- if (err) return
- if (res && res.code == 200) {
- this.$refs.uToast.show({
- type: 'success',
- message: '转移成功',
- complete: () => {
- this.goBack()
- },
- })
- }
- })
- .catch((err) => {
- console.log(err)
- this.$refs.uNotify.show({
- top: this.height + this.paddingTop + 10,
- type: 'warning',
- message: err[0].message,
- duration: 1000 * 3,
- })
- })
- },
- closeUser(user) {
- if (user) {
- console.log(user)
- this.transferObj.userId = user.id
- this.transferObj.userName = user.label
- }
- },
- 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: rgba(62, 126, 248, 0.6);
- border-radius: 50%;
- margin-right: -4rpx;
- }
- }
- .save {
- 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>
|