customerInfo.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  1. <template>
  2. <view class="content">
  3. <u-form :model="form" ref="form" label-width="140">
  4. <u-form-item label="学员姓名" prop="studentName">
  5. <u-input v-model="form.studentName" placeholder=" " disabled />
  6. </u-form-item>
  7. <u-form-item v-if="navbarTitle == '客户信息'" label="学生照片" prop="imageFileId" label-position="top">
  8. <u-upload max-count="1" :deletable="false" :file-list="form.fileList" index="1" :show-progress="false" :preview-full-image="false"></u-upload>
  9. </u-form-item>
  10. <u-form-item label="学员性别" prop="sex" placeholder=" " disabled>
  11. <text>{{ form.sex == '0' ? '男' : '女' }}</text>
  12. <!-- <u-input v-model="form.sex" placeholder=" " disabled /> -->
  13. </u-form-item>
  14. <u-form-item label="学员年龄" prop="age">
  15. <u-input v-model="form.age" placeholder=" " disabled />
  16. </u-form-item>
  17. <u-form-item v-if="navbarTitle == '客户信息'" label="学生生日" prop="birthday">
  18. <u-input v-model="form.birthday" placeholder=" " disabled />
  19. </u-form-item>
  20. <u-form-item label="家长姓名" prop="parentsName">
  21. <u-input v-model="form.parentsName" placeholder=" " disabled />
  22. </u-form-item>
  23. <u-form-item label="手机号码" prop="phone">
  24. <u-input v-model="form.phone" placeholder=" " disabled />
  25. </u-form-item>
  26. </u-form>
  27. <view class="handle-fix-box" style="display:flex;">
  28. <view style="width:50%;">
  29. <u-button type="warning" shape="circle" :ripple="true" :custom-style="customStyle" @click="handleInvalidClick">添加追踪信息</u-button>
  30. </view>
  31. <view style="width:50%;">
  32. <u-button type="warning" shape="circle" :ripple="true" :custom-style="customStyle" @click="handleRecordClick">追踪信息记录</u-button>
  33. </view>
  34. </view>
  35. <!-- 添加追踪 -->
  36. <u-popup v-model="invalidShow" mode="center" border-radius="30" width="600rpx">
  37. <view class="common-title">备注</view>
  38. <view class="menber-box">
  39. <u-form :model="invalidForm" ref="invalidFormRef" label-width="140">
  40. <u-form-item label="备注" prop="content" required>
  41. <u-input v-model="invalidForm.content" type="text" />
  42. </u-form-item>
  43. </u-form>
  44. <view style="height:20px;"></view>
  45. <u-button type="warning" shape="circle" :ripple="true" :custom-style="customStyle" @click="handleConfirmClick">确定</u-button>
  46. </view>
  47. </u-popup>
  48. <!-- 追踪记录 -->
  49. <u-popup v-model="recordShow" mode="center" border-radius="30" width="600rpx" height="500px" >
  50. <view class="common-title">追踪记录</view>
  51. <view class="menber-box" style="overflow-y: auto;height:390px;">
  52. <view style="padding:5px; border-bottom:1px solid #aaa;" v-for="(item,index) in recordList">
  53. <view>{{ item.content }}</view>
  54. <view>{{ item.createTime }}</view>
  55. </view>
  56. </view>
  57. <view class="button-box">
  58. <u-button type="warning" shape="circle" :ripple="true" :custom-style="customStyle" @click="recordShow = false">确定</u-button>
  59. </view>
  60. </u-popup>
  61. <u-top-tips ref="uTips"></u-top-tips>
  62. </view>
  63. </template>
  64. <script>
  65. import {
  66. mapGetters
  67. } from 'vuex'
  68. const NET = require('@/utils/request')
  69. const API = require('@/config/api')
  70. export default {
  71. computed: {
  72. ...mapGetters([
  73. 'customStyle'
  74. ])
  75. },
  76. onLoad(options) {
  77. this.id = options.id
  78. uni.setNavigationBarTitle({
  79. title: options.title
  80. })
  81. this.navbarTitle = options.title
  82. this.getCustomerInfo()
  83. },
  84. data() {
  85. return {
  86. navbarTitle: '',
  87. id: '',
  88. form: {
  89. // 学生姓名
  90. studentName: '',
  91. // 学生照片
  92. fileList: [],
  93. // 学生性别
  94. sex: '',
  95. // 学生年龄
  96. age: '',
  97. // 学生生日
  98. birthday: '',
  99. // 家长姓名
  100. parentsName: '',
  101. // 手机号码
  102. phone: '',
  103. // 沟通记录
  104. resourceRecords: []
  105. },
  106. invalidShow: false,
  107. // 备注
  108. invalidForm: {
  109. customerId: '',
  110. content: ''
  111. },
  112. // 备注校验规则
  113. invalidRules: {
  114. content: [
  115. {
  116. required: true,
  117. message: '请输入备注',
  118. trigger: 'change'
  119. }],
  120. },
  121. // 追踪记录
  122. recordShow: false,
  123. recordList: []
  124. }
  125. },
  126. methods: {
  127. // 客户信息
  128. getCustomerInfo() {
  129. NET.request(API.customerDetail, {
  130. id: parseInt(this.id) }, 'POST').then(res=> {
  131. if(res.status == 10000) {
  132. const result = res.data
  133. this.form.studentName = result.studentName
  134. this.form.fileList.push(result.imageFileUrl)
  135. this.form.sex = result.sex
  136. this.form.age = result.age
  137. this.form.birthday = result.birthday
  138. this.form.parentsName = result.name
  139. this.form.phone = result.phone
  140. this.form.resourceRecords = result.resourceRecords
  141. } else {
  142. this.$refs.uTips.show({
  143. title: error.message,
  144. type: 'warning',
  145. })
  146. }
  147. })
  148. },
  149. // 备注弹窗显示
  150. handleInvalidClick() {
  151. this.invalidForm.customerId = this.id
  152. this.$refs.invalidFormRef.setRules(this.invalidRules)
  153. this.invalidShow = true
  154. },
  155. // 添加追踪记录
  156. handleConfirmClick() {
  157. this.$refs.invalidFormRef.validate(valid => {
  158. if(valid) {
  159. NET.request(API.addResourceRecord, {
  160. ...this.invalidForm }, 'POST').then(res=> {
  161. if(res.status == 10000) {
  162. this.$refs.uTips.show({
  163. title: '添加成功',
  164. type: 'success',
  165. })
  166. } else {
  167. this.$refs.uTips.show({
  168. title: error.message,
  169. type: 'warning',
  170. })
  171. }
  172. this.invalidShow = false
  173. this.invalidForm.content = ''
  174. }
  175. )
  176. }
  177. })
  178. },
  179. // 查看追踪记录
  180. handleRecordClick() {
  181. NET.request(API.findResourceRecordList, {
  182. id: this.id,
  183. page:1,
  184. size: 100}, 'POST').then(res=> {
  185. if(res.status == 10000) {
  186. this.recordShow = true
  187. this.recordList = res.data
  188. } else {
  189. this.$refs.uTips.show({
  190. title: error.message,
  191. type: 'warning',
  192. })
  193. }
  194. })
  195. }
  196. }
  197. }
  198. </script>
  199. <style>
  200. page {
  201. width: 100%;
  202. height: 100%;
  203. position: relative;
  204. }
  205. </style>
  206. <style lang="scss" scoped>
  207. @import "@/static/css/themes.scss";
  208. .content {
  209. width: 100%;
  210. float: left;
  211. padding: 0 15px 60px 15px;
  212. box-sizing: border-box;
  213. }
  214. .menber-box {
  215. width: 100%;
  216. padding: 10px 15px;
  217. .menber-col {
  218. width: 100%;
  219. padding: 15px;
  220. display: inline-block;
  221. background-color: #FFFFFF;
  222. border-radius: 15px;
  223. box-shadow: 0 0 5px 0 rgba(0, 0, 0, 0.2);
  224. position: relative;
  225. overflow: hidden;
  226. box-sizing: border-box;
  227. .menber-label {
  228. width: 100%;
  229. font-size: 14px;
  230. // line-height: 20px;
  231. }
  232. .menber-num {
  233. width: 100%;
  234. font-size: 26px;
  235. line-height: 28px;
  236. color: $mainColor;
  237. }
  238. }
  239. }
  240. .common-title {
  241. width:100%;
  242. text-align: center;
  243. font-size: 20px;
  244. padding: 10px 0;
  245. }
  246. .button-box {
  247. // width: 100%;
  248. padding: 10px 15px;
  249. box-sizing: border-box;
  250. }
  251. </style>