customerInfo.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  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 label="学生照片" prop="imageFileId" label-position="top">
  8. <u-upload max-count="1" :deletable="false" :file-list="form.fileList" index="1"></u-upload>
  9. </u-form-item>
  10. <u-form-item label="学员性别" prop="sex" placeholder=" " disabled>
  11. <!-- <text>{{form.sex}}</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 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.getCustomerInfo()
  82. },
  83. data() {
  84. return {
  85. id: '',
  86. form: {
  87. // 学生姓名
  88. studentName: '',
  89. // 学生照片
  90. fileList: [],
  91. // 学生性别
  92. sex: '',
  93. // 学生年龄
  94. age: '',
  95. // 学生生日
  96. birthday: '',
  97. // 家长姓名
  98. parentsName: '',
  99. // 手机号码
  100. phone: '',
  101. // 沟通记录
  102. resourceRecords: []
  103. },
  104. invalidShow: false,
  105. // 备注
  106. invalidForm: {
  107. customerId: '',
  108. content: ''
  109. },
  110. // 备注校验规则
  111. invalidRules: {
  112. content: [
  113. {
  114. required: true,
  115. message: '请输入备注',
  116. trigger: 'change'
  117. }],
  118. },
  119. // 追踪记录
  120. recordShow: false,
  121. recordList: []
  122. }
  123. },
  124. methods: {
  125. // 客户信息
  126. getCustomerInfo() {
  127. NET.request(API.customerDetail, {
  128. id: parseInt(this.id) }, 'POST').then(res=> {
  129. if(res.status == 10000) {
  130. const result = res.data
  131. this.form.studentName = result.studentName
  132. this.form.fileList.push(result.imageFileUrl)
  133. this.form.sex = result.sex
  134. this.form.age = result.age
  135. this.form.birthday = result.birthday
  136. this.form.parentsName = result.name
  137. this.form.phone = result.phone
  138. this.form.resourceRecords = result.resourceRecords
  139. } else {
  140. this.$refs.uTips.show({
  141. title: error.message,
  142. type: 'warning',
  143. })
  144. }
  145. })
  146. },
  147. // 备注弹窗显示
  148. handleInvalidClick() {
  149. this.invalidForm.customerId = this.id
  150. this.$refs.invalidFormRef.setRules(this.invalidRules)
  151. this.invalidShow = true
  152. },
  153. // 添加追踪记录
  154. handleConfirmClick() {
  155. this.$refs.invalidFormRef.validate(valid => {
  156. if(valid) {
  157. NET.request(API.addResourceRecord, {
  158. ...this.invalidForm }, 'POST').then(res=> {
  159. if(res.status == 10000) {
  160. this.$refs.uTips.show({
  161. title: '添加成功',
  162. type: 'success',
  163. })
  164. } else {
  165. this.$refs.uTips.show({
  166. title: error.message,
  167. type: 'warning',
  168. })
  169. }
  170. this.invalidShow = false
  171. this.invalidForm.content = ''
  172. }
  173. )
  174. }
  175. })
  176. },
  177. // 查看追踪记录
  178. handleRecordClick() {
  179. NET.request(API.findResourceRecordList, {
  180. id: this.id,
  181. page:1,
  182. size: 100}, 'POST').then(res=> {
  183. if(res.status == 10000) {
  184. this.recordShow = true
  185. this.recordList = res.data
  186. } else {
  187. this.$refs.uTips.show({
  188. title: error.message,
  189. type: 'warning',
  190. })
  191. }
  192. })
  193. }
  194. }
  195. }
  196. </script>
  197. <style>
  198. page {
  199. width: 100%;
  200. height: 100%;
  201. position: relative;
  202. }
  203. </style>
  204. <style lang="scss" scoped>
  205. @import "@/static/css/themes.scss";
  206. .content {
  207. width: 100%;
  208. float: left;
  209. padding: 0 15px 60px 15px;
  210. box-sizing: border-box;
  211. }
  212. .menber-box {
  213. width: 100%;
  214. padding: 10px 15px;
  215. .menber-col {
  216. width: 100%;
  217. padding: 15px;
  218. display: inline-block;
  219. background-color: #FFFFFF;
  220. border-radius: 15px;
  221. box-shadow: 0 0 5px 0 rgba(0, 0, 0, 0.2);
  222. position: relative;
  223. overflow: hidden;
  224. box-sizing: border-box;
  225. .menber-label {
  226. width: 100%;
  227. font-size: 14px;
  228. // line-height: 20px;
  229. }
  230. .menber-num {
  231. width: 100%;
  232. font-size: 26px;
  233. line-height: 28px;
  234. color: $mainColor;
  235. }
  236. }
  237. }
  238. .common-title {
  239. width:100%;
  240. text-align: center;
  241. font-size: 20px;
  242. padding: 10px 0;
  243. }
  244. .button-box {
  245. // width: 100%;
  246. padding: 10px 15px;
  247. box-sizing: border-box;
  248. }
  249. </style>