intentionForm.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. <template>
  2. <view class="content">
  3. <u-form :model="form" ref="form" label-width="140">
  4. <u-form-item v-if="fromType == 1" label="线索标签" prop="signName" required right-icon="arrow-right" @click.native="signShow = true">
  5. <text>{{form.signName}}</text>
  6. </u-form-item>
  7. <u-form-item label="家长姓名" prop="parentsName" required>
  8. <u-input v-model="form.parentsName" placeholder="请输入家长姓名" />
  9. </u-form-item>
  10. <u-form-item label="学员姓名" prop="studentName" required>
  11. <u-input v-model="form.studentName" placeholder="请输入学员姓名" />
  12. </u-form-item>
  13. <u-form-item label="学员性别" prop="sex" required right-icon="arrow-right" @click.native="sexShow = true">
  14. <text>{{form.sex}}</text>
  15. </u-form-item>
  16. <u-form-item label="学员年龄" prop="age" required>
  17. <u-input v-model="form.age" type="number" placeholder="请输入学员年龄" />
  18. </u-form-item>
  19. <u-form-item label="手机号码" prop="phone" required >
  20. <u-input v-model="form.phone" type="number" placeholder="请输入手机号码" />
  21. </u-form-item>
  22. <u-form-item label="获客来源" prop="source" required right-icon="arrow-right" @click.native="sourceShow = true">
  23. <text>{{form.source}}</text>
  24. </u-form-item>
  25. <u-form-item label="购卡意向" prop="intendRemark" required right-icon="arrow-right" @click.native="intentionShow = true">
  26. <text>{{form.intendRemark}}</text>
  27. </u-form-item>
  28. <u-form-item label="分配">
  29. <u-checkbox-group>
  30. <u-checkbox @change="handleCheckChange"
  31. shape="circle"
  32. v-model="form.saleIsMeFlag"
  33. v-for="(item, index) in checkList" :key="index"
  34. :name="item.name">
  35. {{ item.name }}
  36. </u-checkbox>
  37. </u-checkbox-group>
  38. </u-form-item>
  39. <u-form-item label="备注">
  40. <u-input v-model="form.remark"placeholder="请输入备注"/>
  41. </u-form-item>
  42. </u-form>
  43. <!-- 标签 -->
  44. <u-action-sheet :list="signList" v-model="signShow" @click="handleSetSexClick"></u-action-sheet>
  45. <!-- 性别 -->
  46. <u-action-sheet :list="sexList" v-model="sexShow" @click="setSex"></u-action-sheet>
  47. <!-- 获客来源 -->
  48. <u-action-sheet :list="sourceList" v-model="sourceShow" @click="handleSetSourceClick"></u-action-sheet>
  49. <!-- 购卡意向 -->
  50. <u-action-sheet :list="intentionList" v-model="intentionShow" @click="handleSetIntentionClick"></u-action-sheet>
  51. <view class="handle-fix-box">
  52. <u-button type="warning" shape="circle" :ripple="true" :custom-style="customStyle" @click="submitForm()">提交</u-button>
  53. </view>
  54. <u-top-tips ref="uTips"></u-top-tips>
  55. </view>
  56. </template>
  57. <script>
  58. import {
  59. mapGetters
  60. } from 'vuex'
  61. const NET = require('@/utils/request')
  62. const API = require('@/config/api')
  63. export default {
  64. computed: {
  65. ...mapGetters([
  66. 'customStyle',
  67. ])
  68. },
  69. data() {
  70. return {
  71. // type 1 线索 2 商机
  72. fromType: null,
  73. form: {
  74. // 线索标签
  75. signName: '未联系',
  76. clueState: 1,
  77. studentName: '',
  78. parentsName: '',
  79. sex: '',
  80. age: '',
  81. phone: '',
  82. source: '',
  83. intendRemark: '',
  84. saleIsMeFlag: true,
  85. remark: ''
  86. },
  87. signShow: false,
  88. signList: [
  89. { text: '无效', type: 0 },
  90. { text: '未联系', type: 1 },
  91. { text: '有意向', type: 2 },
  92. { text: '已预约', type: 3 },
  93. { text: '商机', type: 4 },
  94. ],
  95. sourceShow: false,
  96. sourceList: [
  97. { text: '问卷' },
  98. { text: '电话' },
  99. { text: '转介' },
  100. { text: '活动' }
  101. ],
  102. intentionShow: false,
  103. intentionList: [
  104. { text: '很强' },
  105. { text: '较强' },
  106. { text: '一般' },
  107. { text: '较弱' },
  108. { text: '很弱' }
  109. ],
  110. checkList: [
  111. {
  112. name: '是否分配给当前用户',
  113. checked: false,
  114. disabled: false
  115. }
  116. ],
  117. rules: {
  118. studentName: [{
  119. required: true,
  120. message: '请输入学员姓名',
  121. trigger: 'change'
  122. }],
  123. parentsName: [{
  124. required: true,
  125. message: '请输入家长姓名',
  126. trigger: 'change'
  127. }],
  128. sex: [{
  129. required: true,
  130. message: '请选择学员性别',
  131. trigger: 'change'
  132. }],
  133. age: [{
  134. required: true,
  135. message: '请输入学员年龄',
  136. trigger: 'change'
  137. }],
  138. source: [{
  139. required: true,
  140. message: '请选择获客来源',
  141. trigger: 'change'
  142. }],
  143. intendRemark: [{
  144. required: true,
  145. message: '请选择购买意向',
  146. trigger: 'change'
  147. }],
  148. phone: [{
  149. required: true,
  150. message: '请输入手机号码',
  151. trigger: 'change'
  152. },
  153. {
  154. pattern: /^1[0-9]{10}$/g,
  155. transform(value) {
  156. return String(value);
  157. },
  158. message: '请输入正确格式的手机号码'
  159. },
  160. ],
  161. },
  162. sexShow: false,
  163. sexList: [
  164. { text: '男' },
  165. { text: '女' }
  166. ]
  167. }
  168. },
  169. onLoad(options) {
  170. // type 1 线索 2 商机
  171. this.fromType = options.type
  172. if(options.type == 2) {
  173. this.form.signName = '商机'
  174. this.form.clueState = 4
  175. }
  176. },
  177. onReady() {
  178. this.$refs.form.setRules(this.rules);
  179. },
  180. methods: {
  181. // 单选
  182. handleCheckChange(e) {
  183. this.form.saleIsMeFlag = e.value
  184. },
  185. // 设置线索标签
  186. handleSetSexClick(index) {
  187. this.form.signName = this.signList[index].text
  188. this.form.clueState = this.signList[index].type
  189. },
  190. // 获客来源
  191. handleSetSourceClick(index) {
  192. this.form.source = this.sourceList[index].text
  193. },
  194. // 购卡意向
  195. handleSetIntentionClick(index) {
  196. this.form.intendRemark = this.intentionList[index].text
  197. },
  198. // 设置性别
  199. setSex(index) {
  200. this.form.sex = this.sexList[index].text
  201. },
  202. // 提交表单
  203. submitForm() {
  204. console.log(this.form);
  205. this.$refs.form.validate(valid => {
  206. if (valid) {
  207. NET.request(API.submitIntentionForm, {
  208. ...this.form
  209. }, 'POST').then(res => {
  210. this.$refs.uTips.show({
  211. title: '提交成功',
  212. type: 'success',
  213. })
  214. setTimeout(() => {
  215. uni.navigateBack()
  216. }, 1000)
  217. }).catch(error => {
  218. this.$refs.uTips.show({
  219. title: error.message,
  220. type: 'warning',
  221. })
  222. })
  223. }
  224. });
  225. },
  226. },
  227. }
  228. </script>
  229. <style>
  230. page {
  231. width: 100%;
  232. height: 100%;
  233. position: relative;
  234. }
  235. </style>
  236. <style lang="scss" scoped>
  237. @import "@/static/css/themes.scss";
  238. .content {
  239. width: 100%;
  240. float: left;
  241. padding: 0 15px 60px 15px;
  242. box-sizing: border-box;
  243. }
  244. </style>