customerInfo.vue 8.7 KB

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