customerDetails.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. <template>
  2. <view class="content">
  3. <view class="top-box" v-if="item!=null">
  4. <view class="customer-box">
  5. <view class="left">
  6. <view class="name">{{item.customerName}}</view>
  7. <view class="desc-box">
  8. <view class="label">创建时间:</view>
  9. <view class="value"> {{item.createTime}}</view>
  10. </view>
  11. <view class="desc-box">
  12. <view class="label">地址:</view>
  13. <view class="value">{{item.address}} </view>
  14. </view>
  15. </view>
  16. <view class="btns">
  17. <image class="btn" src="../../../static/images/sms.png"></image>
  18. <image class="btn" src="../../../static/images/phone.png"></image>
  19. </view>
  20. </view>
  21. <view class="tabs">
  22. <u-tabs
  23. :scrollable="true"
  24. :list="tabs"
  25. lineColor="#115296"
  26. @change="tagChange">
  27. </u-tabs>
  28. </view>
  29. <view class="cont-box">
  30. <customer-info ref="customerInfo" v-if="tabId==1"></customer-info>
  31. </view>
  32. </view>
  33. <u-modal :show="show" ref="uModal" :asyncClose="true" :showCancelButton="true" title="提示" @cancel="close" @confirm="confirm" :content='content'></u-modal>
  34. </view>
  35. </template>
  36. <script>
  37. import customerInfo from './components/customerInfo.vue'
  38. import {getCustomerDetails,editCrmCustomer} from '@/api/crm.js'
  39. export default {
  40. components:{
  41. customerInfo, // 基本信息
  42. },
  43. data() {
  44. return {
  45. wxNickName:null,
  46. show:false,
  47. content:"",
  48. customerId:null,
  49. tabId:1,
  50. item:null,
  51. tabs:[
  52. {
  53. id:1,
  54. name:'用户资料'
  55. },
  56. {
  57. id:2,
  58. name:'联系人'
  59. },
  60. {
  61. id:3,
  62. name:'跟进记录'
  63. },
  64. {
  65. id:4,
  66. name:'通话记录'
  67. },
  68. {
  69. id:5,
  70. name:'短信记录'
  71. }
  72. ],
  73. }
  74. },
  75. onLoad(option) {
  76. var that=this;
  77. uni.$on('getWeixinId', (item) => {
  78. console.log(item)
  79. that.content="用户昵称:"+item.data+",是否更新";
  80. that.wxNickName=item.data;
  81. that.show=true;
  82. })
  83. this.customerId=option.customerId
  84. console.log(this.customerId)
  85. this.getCustomerDetails()
  86. },
  87. onShow() {
  88. },
  89. methods: {
  90. close(){
  91. this.show=false;
  92. },
  93. confirm(){
  94. this.show=false;
  95. var data = {
  96. customerId:this.customerId,
  97. weixin:this.wxNickName
  98. };
  99. //更新用户昵称
  100. var that=this;
  101. editCrmCustomer(data).then(res => {
  102. if(res.code==200){
  103. uni.showToast({
  104. icon:'none',
  105. title: "操作成功",
  106. });
  107. if(this.tabId==1){
  108. setTimeout(function(){
  109. that.$refs.customerInfo.getCustomerDetails(that.customerId)
  110. },200);
  111. }
  112. }else{
  113. uni.showToast({
  114. icon:'none',
  115. title: res.msg,
  116. });
  117. }
  118. });
  119. },
  120. tagChange(item){
  121. this.tabId=item.id
  122. var that = this;
  123. if(this.tabId==1){
  124. setTimeout(function(){
  125. that.$refs.customerInfo.getCustomerDetails(that.customerId)
  126. },200);
  127. }
  128. },
  129. getCustomerDetails() {
  130. //联网加载数据
  131. var that = this;
  132. var data = {
  133. customerId:this.customerId
  134. };
  135. getCustomerDetails(data).then(res => {
  136. if(res.code==200){
  137. this.item=res.customer;
  138. setTimeout(function(){
  139. that.$refs.customerInfo.getCustomerDetails(that.customerId)
  140. },200);
  141. }else{
  142. uni.showToast({
  143. icon:'none',
  144. title: res.msg,
  145. });
  146. setTimeout(function(){
  147. uni.navigateBack()
  148. },2000);
  149. }
  150. });
  151. },
  152. }
  153. }
  154. </script>
  155. <style lang="scss">
  156. page{
  157. height: 100%;
  158. background: #f6f6f6;
  159. }
  160. </style>
  161. <style scoped lang="scss">
  162. .content{
  163. height: 100%;
  164. padding: 20rpx;
  165. .top-box{
  166. padding: 15rpx;
  167. background-color: #fff;
  168. margin-bottom: 15rpx;
  169. border-radius: 15rpx;
  170. width: 100%;
  171. .customer-box{
  172. width: 100%;
  173. display: flex;
  174. align-items: flex-start;
  175. justify-content: flex-start;
  176. .left{
  177. flex: 1;
  178. font-size: 38rpx;
  179. color:#111;
  180. .name{
  181. flex: 1;
  182. font-size: 42rpx;
  183. color:#111;
  184. }
  185. .desc-box{
  186. margin-top: 15rpx;
  187. width: 100%;
  188. display: flex;
  189. align-items: center;
  190. justify-content: flex-start;
  191. .label{
  192. font-size: 28rpx;
  193. color: #a8a8a8;
  194. }
  195. .value{
  196. font-size: 28rpx;
  197. color: #a8a8a8;
  198. }
  199. }
  200. }
  201. .btns{
  202. .btn{
  203. margin-left: 10rpx;
  204. width: 45rpx;
  205. height:45rpx;
  206. }
  207. }
  208. }
  209. }
  210. }
  211. </style>