cardDetail.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. <template>
  2. <view>
  3. <view class="card-box clearfix" v-if="!loading">
  4. <image class="card-bottom" src="/static/images/card_bottom.png" mode="widthFix"></image>
  5. <view class="hearder">
  6. <image :src="cardInfo.avatar" style="border-radius: 100%;"></image>
  7. </view>
  8. <view class="user-name">{{ cardInfo.realName }}</view>
  9. <view class="user-tag ddflex">
  10. <view class="user-tag-item">{{ cardInfo.jobName }}</view>
  11. <view class="user-tag-item">入司{{cardInfo.inDate?monthDayDiff(cardInfo.inDate):'1年'}}</view>
  12. </view>
  13. <view class="pf">
  14. <view class="pf-title">综合评分</view>
  15. <uni-rate style="justify-content: center;" class="ddflex" color="#999999" active-color="#FF4600" :readonly="true" size="18" allow-half :value="evaluateInfo.info.avage/2" />
  16. </view>
  17. <view class="user-data ddflex">
  18. <view>
  19. <view class="user-data-num">{{cardInfo.cntCust?cardInfo.cntCust:0}}</view>
  20. <view class="user-data-label ddflex">
  21. <image src="/static/pages/images/fw_hui.png"></image>
  22. <view>服务客户</view>
  23. </view>
  24. </view>
  25. <view style="margin-left: 109rpx;">
  26. <view class="user-data-num">{{cardInfo.cntCntr?cardInfo.cntCntr:0}}</view>
  27. <view class="user-data-label ddflex">
  28. <image src="/static/pages/images/cy_hui.png"></image>
  29. <view>保单件数</view>
  30. </view>
  31. </view>
  32. <view style="margin-left: 109rpx;">
  33. <view class="user-data-num">{{cardInfo.thumbs?cardInfo.thumbs:0}}</view>
  34. <view class="user-data-label ddflex">
  35. <image src="/static/pages/images/dz_hui.png"></image>
  36. <view>点赞量</view>
  37. </view>
  38. </view>
  39. </view>
  40. <view class="user-des">
  41. <rich-text :nodes="cardInfo.brief ? cardInfo.brief : ''"></rich-text>
  42. </view>
  43. <image class="user-code" :src="code?code:'/static/images/lj_img.png'"></image>
  44. <block v-if="!noBind">
  45. <view class="user-btn" @click="submit">
  46. 选TA做专属顾问
  47. </view>
  48. <view class="user-btn-text" @click="jumpUrl('/card/cardList/cardList')">
  49. 更多专属顾问>
  50. </view>
  51. </block>
  52. <!-- 解绑 -->
  53. <block v-else>
  54. <view class="user-btn" @click="bindCancal">
  55. 解除绑定
  56. </view>
  57. </block>
  58. </view>
  59. <update-userinfo :update-info="isUpdateInfo" :update-mobile="isUpdateMobile" :is-update="true" v-if="isShowUpdate" @closeUpdate="closeUpdate" @updateMobile="updateMobileInfo" @updateInfo="updateInfo"></update-userinfo>
  60. </view>
  61. </template>
  62. <script>
  63. const app = getApp();
  64. const req = require("../../utils/request.js");
  65. import util from '../../utils/util.js';
  66. export default {
  67. components: {},
  68. props: {},
  69. data() {
  70. return {
  71. systems: {},
  72. isTop:0,
  73. id:null,
  74. cardInfo:{},
  75. evaluateInfo:{},
  76. code:'',
  77. loading:true,
  78. noBind:false,
  79. isShowUpdate: false, //是否显示更新信息弹窗
  80. isUpdateInfo: false, //更新用户信息
  81. isUpdateMobile: false, //绑定手机号
  82. }
  83. },
  84. onLoad(options) {
  85. this.id = options.id
  86. if(options.noBind){
  87. this.noBind = true
  88. }
  89. uni.showLoading({
  90. title:'加载中'
  91. })
  92. this.getCardInfo()
  93. },
  94. onShow() {
  95. },
  96. methods: {
  97. jumpUrl(url){
  98. uni.navigateTo({
  99. url:url
  100. })
  101. },
  102. getCardInfo() {
  103. var url = '';
  104. var dataP = {
  105. id:this.id
  106. };
  107. url = '/api/visiting/card/info';
  108. req.getRequest(url, dataP, data => {
  109. this.cardInfo = data;
  110. uni.hideLoading()
  111. this.loading = false
  112. this.getEvaluate()
  113. this.getCodeUrl()
  114. });
  115. },
  116. // 获取评论
  117. getEvaluate(){
  118. req.getRequest('/api/evaluate/cardInfo',{bindId:this.id,type:2},res=>{
  119. this.evaluateInfo = res
  120. })
  121. },
  122. getCodeUrl() {
  123. let that = this; //获取小程序码
  124. const params = {
  125. page: 'card/index/index',
  126. params: this.cardInfo.id
  127. };
  128. return new Promise((resolve, reject) => {
  129. req.getRequest('/api/other/program/code', params, url => {
  130. // console.log(url);
  131. this.code = url
  132. resolve();
  133. });
  134. });
  135. },
  136. monthDayDiff(date) {
  137. return util.monthDayDiff(date)
  138. },
  139. submit(){
  140. let userInfo = req.getStorage('userInfo');
  141. console.log('updateInfo userInfo.avatar',userInfo.avatar)
  142. if (!userInfo.avatar || !userInfo.nickName || userInfo.avatar.indexOf('thirdwx.qlogo') > -1 || userInfo.nickName.indexOf('用户') > -1) {
  143. this.isShowUpdate = true
  144. this.isUpdateInfo = true
  145. return false
  146. }
  147. if(userInfo.avatar&&!userInfo.mobile){
  148. this.isShowUpdate = true
  149. this.isUpdateMobile = true
  150. return false
  151. }
  152. uni.showModal({
  153. title:'提示',
  154. content:'是否绑定该顾问?',
  155. success: (con) => {
  156. if(con.confirm){
  157. req.postRequest('/api/visiting/card/bindManageSaleNo',{manageSaleNo:this.cardInfo.jobNumber},res=>{
  158. req.msg('已切换专属顾问')
  159. let userInfo = req.getStorage('userInfo')
  160. userInfo.manageSaleNo = this.cardInfo.jobNumber
  161. req.setStorage('userInfo',userInfo)
  162. setTimeout(()=>{
  163. uni.switchTab({
  164. url:'/pages/index/index'
  165. })
  166. },1000)
  167. })
  168. }
  169. }
  170. })
  171. },
  172. showUpdate(){
  173. this.isShowUpdate = true;
  174. this.isUpdateInfo = true;
  175. },
  176. closeUpdate(){
  177. this.isShowUpdate = false
  178. this.isUpdateInfo = false;
  179. },
  180. updateInfo(e){
  181. setTimeout(()=>{
  182. this.submit()
  183. },500)
  184. },
  185. updateMobileInfo(e){
  186. setTimeout(()=>{
  187. this.submit()
  188. },500)
  189. },
  190. // 解绑
  191. bindCancal(){
  192. uni.showModal({
  193. title:'提示',
  194. content:'确定解除绑定?',
  195. success: (con) => {
  196. if(con.confirm){
  197. req.postRequest('/api/visiting/card/unBindManageSaleNo',{},res=>{
  198. req.msg('已解除绑定')
  199. let userInfo = req.getStorage('userInfo')
  200. userInfo.manageSaleNo = ''
  201. req.setStorage('userInfo',userInfo)
  202. setTimeout(()=>{
  203. uni.navigateBack()
  204. },1000)
  205. })
  206. }
  207. }
  208. })
  209. }
  210. },
  211. mounted() {
  212. const systemInfo = uni.getSystemInfoSync();
  213. // px转换到rpx的比例
  214. let pxToRpxScale = 750 / systemInfo.windowWidth;
  215. let systems = {
  216. ktxStatusHeight: systemInfo.statusBarHeight * pxToRpxScale, // 状态栏的高度
  217. navigationHeight: 44 * pxToRpxScale // 导航栏的高度
  218. };
  219. systems.barHeight = systems.ktxStatusHeight + systems.navigationHeight;
  220. this.systems = systems;
  221. },
  222. onPageScroll: function(e) {
  223. if (e.scrollTop > this.systems.barHeight) {
  224. this.isTop = 1;
  225. } else {
  226. this.isTop = 0;
  227. }
  228. }
  229. }
  230. </script>
  231. <style>
  232. @import "./cardDetail.css";
  233. </style>