transfer.vue 6.1 KB

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