transfer.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  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()"></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. console.log(option.id) //打印出上个页面传递的参数。
  97. this.transferObj.id = parseInt(option.id)
  98. },
  99. onShow() {},
  100. methods: {
  101. handleAdd() {
  102. this.$refs.addForm
  103. .validate()
  104. .then(async () => {
  105. console.log(1111)
  106. let params = this.transferObj
  107. console.log(params)
  108. const [err, res] = await to(projectApi.transfer(params))
  109. if (err) return
  110. if (res && res.code == 200) {
  111. this.$refs.uToast.show({
  112. type: 'success',
  113. message: '转移成功',
  114. complete: () => {
  115. this.goBack()
  116. },
  117. })
  118. }
  119. })
  120. .catch((err) => {
  121. console.log(err)
  122. this.$refs.uNotify.show({
  123. top: this.height + this.paddingTop + 10,
  124. type: 'warning',
  125. message: err[0].message,
  126. duration: 1000 * 3,
  127. })
  128. })
  129. },
  130. closeUser(user) {
  131. if (user) {
  132. console.log(user)
  133. this.transferObj.userId = user.id
  134. this.transferObj.userName = user.label
  135. }
  136. },
  137. goBack() {
  138. uni.navigateBack({
  139. //关闭当前页面,返回上一页面或多级页面。
  140. delta: 1,
  141. })
  142. },
  143. },
  144. }
  145. </script>
  146. <style>
  147. page {
  148. background: #f2f3f5;
  149. }
  150. </style>
  151. <style lang="scss" scoped>
  152. .home {
  153. padding-top: 188rpx;
  154. .nav {
  155. position: absolute;
  156. left: 0;
  157. top: 0;
  158. width: 100%;
  159. height: 284rpx;
  160. background: #3e7ef8;
  161. .title {
  162. position: relative;
  163. text-align: center;
  164. font-size: 32rpx;
  165. font-weight: bold;
  166. color: #ffffff;
  167. .back {
  168. position: absolute;
  169. top: 0;
  170. bottom: 0;
  171. margin: auto;
  172. left: 70rpx;
  173. display: flex;
  174. }
  175. }
  176. }
  177. .main {
  178. position: absolute;
  179. width: 100%;
  180. height: calc(100vh - 188rpx);
  181. background: #ffffff;
  182. box-shadow: 0 6rpx 19rpx 2rpx rgba(0, 45, 132, 0.15);
  183. border-radius: 31rpx 31rpx 0 0;
  184. padding: 0 32rpx;
  185. overflow: auto;
  186. padding-bottom: 64rpx;
  187. .form-label {
  188. font-size: 32rpx;
  189. font-weight: bold;
  190. color: #323232;
  191. padding-bottom: 18rpx;
  192. .label-tag {
  193. width: 15rpx;
  194. height: 15rpx;
  195. background: rgba(62, 126, 248, 0.6);
  196. border-radius: 50%;
  197. margin-right: -4rpx;
  198. }
  199. }
  200. .save {
  201. width: 569rpx;
  202. height: 92rpx;
  203. background: #3e7ef8;
  204. border-radius: 31rpx;
  205. margin: 116rpx auto 0;
  206. font-size: 32rpx;
  207. color: #ffffff;
  208. text-align: center;
  209. line-height: 92rpx;
  210. }
  211. }
  212. }
  213. </style>