customerInfo.vue 6.7 KB

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