transfer.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  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" :class="!flag ? 'disabledBtn' : ''">保存</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. flag:true,
  76. height: '',
  77. paddingTop: '',
  78. transferObj: {
  79. remark: '',
  80. salesId: null, //接受的销售id、name
  81. salesName: '', //接受的销售id、name
  82. ids: [], //客户id
  83. about: ['客户'],
  84. },
  85. rules: {
  86. salesName: {
  87. type: 'string',
  88. required: true,
  89. message: '请选择转移对象',
  90. trigger: ['blur'],
  91. },
  92. remark: {
  93. type: 'string',
  94. required: true,
  95. message: '请输入转移原因',
  96. trigger: ['blur', 'change'],
  97. },
  98. },
  99. }
  100. },
  101. created() {
  102. const navData = uni.getMenuButtonBoundingClientRect()
  103. this.height = navData.height + 'px'
  104. this.paddingTop = navData.top + 'px'
  105. },
  106. onLoad(option) {
  107. this.transferObj.ids = [parseInt(option.id)]
  108. },
  109. onShow() {},
  110. methods: {
  111. handleAdd() {
  112. if(!this.flag) return
  113. this.$refs.addForm
  114. .validate()
  115. .then(async () => {
  116. let params = this.transferObj
  117. this.flag = false
  118. const [err, res] = await to(customerApi.transfer(params))
  119. this.flag = true
  120. if (err) return
  121. if (res && res.code == 200) {
  122. this.$refs.uToast.show({
  123. type: 'success',
  124. message: '转移成功',
  125. complete: () => {
  126. this.goBack()
  127. },
  128. })
  129. }
  130. })
  131. .catch((err) => {
  132. this.$refs.uNotify.show({
  133. top: this.height + this.paddingTop + 10,
  134. type: 'warning',
  135. message: err[0].message,
  136. duration: 1000 * 3,
  137. })
  138. })
  139. },
  140. closeUser(user) {
  141. if (user) {
  142. this.transferObj.salesId = user.id
  143. this.transferObj.salesName = user.label
  144. }
  145. },
  146. goBack() {
  147. uni.navigateBack({
  148. //关闭当前页面,返回上一页面或多级页面。
  149. delta: 1,
  150. })
  151. },
  152. },
  153. }
  154. </script>
  155. <style>
  156. page {
  157. background: #f2f3f5;
  158. }
  159. </style>
  160. <style lang="scss" scoped>
  161. .home {
  162. padding-top: 188rpx;
  163. .nav {
  164. position: absolute;
  165. left: 0;
  166. top: 0;
  167. width: 100%;
  168. height: 284rpx;
  169. background: #3e7ef8;
  170. .title {
  171. position: relative;
  172. text-align: center;
  173. font-size: 32rpx;
  174. font-weight: bold;
  175. color: #ffffff;
  176. .back {
  177. position: absolute;
  178. top: 0;
  179. bottom: 0;
  180. margin: auto;
  181. left: 70rpx;
  182. display: flex;
  183. }
  184. }
  185. }
  186. .main {
  187. position: absolute;
  188. width: 100%;
  189. height: calc(100vh - 188rpx);
  190. background: #ffffff;
  191. box-shadow: 0 6rpx 19rpx 2rpx rgba(0, 45, 132, 0.15);
  192. border-radius: 31rpx 31rpx 0 0;
  193. padding: 0 32rpx;
  194. overflow: auto;
  195. padding-bottom: 64rpx;
  196. .form-label {
  197. font-size: 32rpx;
  198. font-weight: bold;
  199. color: #323232;
  200. padding-bottom: 18rpx;
  201. .label-tag {
  202. width: 15rpx;
  203. height: 15rpx;
  204. background: #ff4d4f;
  205. border-radius: 50%;
  206. margin-right: 10rpx;
  207. }
  208. }
  209. .save {
  210. width: 569rpx;
  211. height: 92rpx;
  212. background: #3e7ef8;
  213. border-radius: 31rpx;
  214. margin: 116rpx auto 0;
  215. font-size: 32rpx;
  216. color: #ffffff;
  217. text-align: center;
  218. line-height: 92rpx;
  219. }
  220. }
  221. }
  222. </style>