transfer.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. <!--
  2. * @Author: liuzhenlin 461480418@qq.ocm
  3. * @Date: 2023-01-12 11:57:48
  4. * @LastEditors: liuzhenlin
  5. * @LastEditTime: 2023-02-17 14:33:19
  6. * @Description: file content
  7. * @FilePath: \oms\pages\project\transfer.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="transferObj" :rules="rules" ref="addForm" label-width="0">
  23. <u-form-item prop="userName" borderBottom customStyle="padding:40rpx 0 30rpx" @click="$refs.user.open()">
  24. <view class="form-label flex_l">
  25. <view class="label-tag"></view>
  26. 接收对象
  27. </view>
  28. <u-input
  29. v-model="transferObj.userName"
  30. disabled
  31. disabledColor="#ffffff"
  32. placeholder="请选择接收对象"
  33. border="none"></u-input>
  34. <u-icon slot="right" name="arrow-right"></u-icon>
  35. </u-form-item>
  36. <u-form-item prop="remark" customStyle="padding:40rpx 0 30rpx">
  37. <view class="form-label flex_l">
  38. <view class="label-tag"></view>
  39. 转移原因
  40. </view>
  41. <u-textarea
  42. fontSize="26rpx"
  43. v-model="transferObj.remark"
  44. placeholder="请输入转移原因"
  45. height="180"
  46. :count="true"
  47. maxlength="300"></u-textarea>
  48. </u-form-item>
  49. </u-form>
  50. <view class="save" @click="handleAdd">保存</view>
  51. </view>
  52. <u-notify ref="uNotify"></u-notify>
  53. <u-toast ref="uToast"></u-toast>
  54. <select-user ref="user" @close="closeUser($event)"></select-user>
  55. </view>
  56. </template>
  57. <script>
  58. import projectApi from '../../api/project'
  59. import SelectUser from '../../components/SelectUser'
  60. import to from 'await-to-js'
  61. export default {
  62. name: 'omsIndex',
  63. components: { SelectUser },
  64. data() {
  65. return {
  66. height: '',
  67. paddingTop: '',
  68. transferObj: {
  69. remark: '',
  70. userId: null, //接收对象id
  71. userName: '', //接收对象name
  72. id: 0, //客户id
  73. },
  74. rules: {
  75. userName: {
  76. type: 'string',
  77. required: true,
  78. message: '请选择转移对象',
  79. trigger: ['blur'],
  80. },
  81. remark: {
  82. type: 'string',
  83. required: true,
  84. message: '请输入转移原因',
  85. trigger: ['blur', 'change'],
  86. },
  87. },
  88. }
  89. },
  90. created() {
  91. const navData = uni.getMenuButtonBoundingClientRect()
  92. this.height = navData.height + 'px'
  93. this.paddingTop = navData.top + 'px'
  94. },
  95. onLoad(option) {
  96. this.transferObj.id = parseInt(option.id)
  97. },
  98. onShow() {},
  99. methods: {
  100. handleAdd() {
  101. this.$refs.addForm
  102. .validate()
  103. .then(async () => {
  104. let params = this.transferObj
  105. const [err, res] = await to(projectApi.transfer(params))
  106. if (err) return
  107. if (res && res.code == 200) {
  108. this.$refs.uToast.show({
  109. type: 'success',
  110. message: '转移成功',
  111. complete: () => {
  112. this.goBack()
  113. },
  114. })
  115. }
  116. })
  117. .catch((err) => {
  118. this.$refs.uNotify.show({
  119. top: this.height + this.paddingTop + 10,
  120. type: 'warning',
  121. message: err[0].message,
  122. duration: 1000 * 3,
  123. })
  124. })
  125. },
  126. closeUser(user) {
  127. if (user) {
  128. this.transferObj.userId = user.id
  129. this.transferObj.userName = user.label
  130. }
  131. },
  132. goBack() {
  133. uni.navigateBack({
  134. //关闭当前页面,返回上一页面或多级页面。
  135. delta: 1,
  136. })
  137. },
  138. },
  139. }
  140. </script>
  141. <style>
  142. page {
  143. background: #f2f3f5;
  144. }
  145. </style>
  146. <style lang="scss" scoped>
  147. .home {
  148. padding-top: 188rpx;
  149. .nav {
  150. position: absolute;
  151. left: 0;
  152. top: 0;
  153. width: 100%;
  154. height: 284rpx;
  155. background: #3e7ef8;
  156. .title {
  157. position: relative;
  158. text-align: center;
  159. font-size: 32rpx;
  160. font-weight: bold;
  161. color: #ffffff;
  162. .back {
  163. position: absolute;
  164. top: 0;
  165. bottom: 0;
  166. margin: auto;
  167. left: 70rpx;
  168. display: flex;
  169. }
  170. }
  171. }
  172. .main {
  173. position: absolute;
  174. width: 100%;
  175. height: calc(100vh - 188rpx);
  176. background: #ffffff;
  177. box-shadow: 0 6rpx 19rpx 2rpx rgba(0, 45, 132, 0.15);
  178. border-radius: 31rpx 31rpx 0 0;
  179. padding: 0 32rpx;
  180. overflow: auto;
  181. padding-bottom: 64rpx;
  182. .form-label {
  183. font-size: 32rpx;
  184. font-weight: bold;
  185. color: #323232;
  186. padding-bottom: 18rpx;
  187. .label-tag {
  188. width: 15rpx;
  189. height: 15rpx;
  190. background: #ff4d4f;
  191. border-radius: 50%;
  192. margin-right: 10rpx;
  193. }
  194. }
  195. .save {
  196. width: 569rpx;
  197. height: 92rpx;
  198. background: #3e7ef8;
  199. border-radius: 31rpx;
  200. margin: 116rpx auto 0;
  201. font-size: 32rpx;
  202. color: #ffffff;
  203. text-align: center;
  204. line-height: 92rpx;
  205. }
  206. }
  207. }
  208. </style>