cardDetail.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  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. </view>
  60. </template>
  61. <script>
  62. const app = getApp();
  63. const req = require("../../utils/request.js");
  64. import util from '../../utils/util.js';
  65. export default {
  66. components: {},
  67. props: {},
  68. data() {
  69. return {
  70. systems: {},
  71. isTop:0,
  72. id:null,
  73. cardInfo:{},
  74. evaluateInfo:{},
  75. code:'',
  76. loading:true,
  77. noBind:false
  78. }
  79. },
  80. onLoad(options) {
  81. this.id = options.id
  82. if(options.noBind){
  83. this.noBind = true
  84. }
  85. uni.showLoading({
  86. title:'加载中'
  87. })
  88. this.getCardInfo()
  89. },
  90. onShow() {
  91. },
  92. methods: {
  93. jumpUrl(url){
  94. uni.navigateTo({
  95. url:url
  96. })
  97. },
  98. getCardInfo() {
  99. var url = '';
  100. var dataP = {
  101. id:this.id
  102. };
  103. url = '/api/visiting/card/info';
  104. req.getRequest(url, dataP, data => {
  105. this.cardInfo = data;
  106. uni.hideLoading()
  107. this.loading = false
  108. this.getEvaluate()
  109. this.getCodeUrl()
  110. });
  111. },
  112. // 获取评论
  113. getEvaluate(){
  114. req.getRequest('/api/evaluate/cardInfo',{bindId:this.id,type:2},res=>{
  115. this.evaluateInfo = res
  116. })
  117. },
  118. getCodeUrl() {
  119. let that = this; //获取小程序码
  120. const params = {
  121. page: 'card/index/index',
  122. params: this.cardInfo.id
  123. };
  124. return new Promise((resolve, reject) => {
  125. req.getRequest('/api/other/program/code', params, url => {
  126. // console.log(url);
  127. this.code = url
  128. resolve();
  129. });
  130. });
  131. },
  132. monthDayDiff(date) {
  133. return util.monthDayDiff(date)
  134. },
  135. submit(){
  136. req.postRequest('/api/visiting/card/bindManageSaleNo',{manageSaleNo:this.cardInfo.jobNumber},res=>{
  137. req.msg('已切换专属顾问')
  138. let userInfo = req.getStorage('userInfo')
  139. userInfo.manageSaleNo = this.cardInfo.jobNumber
  140. req.setStorage('userInfo',userInfo)
  141. setTimeout(()=>{
  142. uni.switchTab({
  143. url:'/pages/index/index'
  144. })
  145. },1000)
  146. })
  147. },
  148. // 解绑
  149. bindCancal(){
  150. uni.showModal({
  151. title:'提示',
  152. content:'确定解除绑定?',
  153. success: (con) => {
  154. if(con.confirm){
  155. req.postRequest('/api/visiting/card/unBindManageSaleNo',{},res=>{
  156. req.msg('已解除绑定')
  157. let userInfo = req.getStorage('userInfo')
  158. userInfo.manageSaleNo = ''
  159. req.setStorage('userInfo',userInfo)
  160. setTimeout(()=>{
  161. uni.navigateBack()
  162. },1000)
  163. })
  164. }
  165. }
  166. })
  167. }
  168. },
  169. mounted() {
  170. const systemInfo = uni.getSystemInfoSync();
  171. // px转换到rpx的比例
  172. let pxToRpxScale = 750 / systemInfo.windowWidth;
  173. let systems = {
  174. ktxStatusHeight: systemInfo.statusBarHeight * pxToRpxScale, // 状态栏的高度
  175. navigationHeight: 44 * pxToRpxScale // 导航栏的高度
  176. };
  177. systems.barHeight = systems.ktxStatusHeight + systems.navigationHeight;
  178. this.systems = systems;
  179. },
  180. onPageScroll: function(e) {
  181. if (e.scrollTop > this.systems.barHeight) {
  182. this.isTop = 1;
  183. } else {
  184. this.isTop = 0;
  185. }
  186. }
  187. }
  188. </script>
  189. <style>
  190. @import "./cardDetail.css";
  191. </style>