transfer.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. <!--
  2. * @Author: liuzhenlin 461480418@qq.ocm
  3. * @Date: 2023-01-12 11:57:48
  4. * @LastEditors: liuzhenlin
  5. * @LastEditTime: 2023-02-15 15:28:15
  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: ['Sales', 'SalesManager'] }" @close="closeUser()"></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. console.log(option.id) //打印出上个页面传递的参数。
  107. this.transferObj.ids = [parseInt(option.id)]
  108. },
  109. onShow() {},
  110. methods: {
  111. handleAdd() {
  112. this.$refs.addForm
  113. .validate()
  114. .then(async () => {
  115. console.log(1111)
  116. let params = this.transferObj
  117. console.log(params)
  118. const [err, res] = await to(customerApi.transfer(params))
  119. if (err) return
  120. if (res && res.code == 200) {
  121. this.$refs.uToast.show({
  122. type: 'success',
  123. message: '转移成功',
  124. complete: () => {
  125. this.goBack()
  126. },
  127. })
  128. }
  129. })
  130. .catch((err) => {
  131. console.log(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. console.log(user)
  143. this.transferObj.salesId = user.id
  144. this.transferObj.salesName = user.label
  145. }
  146. },
  147. goBack() {
  148. uni.navigateBack({
  149. //关闭当前页面,返回上一页面或多级页面。
  150. delta: 1,
  151. })
  152. },
  153. },
  154. }
  155. </script>
  156. <style>
  157. page {
  158. background: #f2f3f5;
  159. }
  160. </style>
  161. <style lang="scss" scoped>
  162. .home {
  163. padding-top: 188rpx;
  164. .nav {
  165. position: absolute;
  166. left: 0;
  167. top: 0;
  168. width: 100%;
  169. height: 284rpx;
  170. background: #3e7ef8;
  171. .title {
  172. position: relative;
  173. text-align: center;
  174. font-size: 32rpx;
  175. font-weight: bold;
  176. color: #ffffff;
  177. .back {
  178. position: absolute;
  179. top: 0;
  180. bottom: 0;
  181. margin: auto;
  182. left: 70rpx;
  183. display: flex;
  184. }
  185. }
  186. }
  187. .main {
  188. position: absolute;
  189. width: 100%;
  190. height: calc(100vh - 188rpx);
  191. background: #ffffff;
  192. box-shadow: 0 6rpx 19rpx 2rpx rgba(0, 45, 132, 0.15);
  193. border-radius: 31rpx 31rpx 0 0;
  194. padding: 0 32rpx;
  195. overflow: auto;
  196. padding-bottom: 64rpx;
  197. .form-label {
  198. font-size: 32rpx;
  199. font-weight: bold;
  200. color: #323232;
  201. padding-bottom: 18rpx;
  202. .label-tag {
  203. width: 15rpx;
  204. height: 15rpx;
  205. background: #ff4d4f;
  206. border-radius: 50%;
  207. margin-right: 10rpx;
  208. }
  209. }
  210. .save {
  211. width: 569rpx;
  212. height: 92rpx;
  213. background: #3e7ef8;
  214. border-radius: 31rpx;
  215. margin: 116rpx auto 0;
  216. font-size: 32rpx;
  217. color: #ffffff;
  218. text-align: center;
  219. line-height: 92rpx;
  220. }
  221. }
  222. }
  223. </style>