call.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. <template class="bc#f6f6f6">
  2. <view style="width: 100%;height: 100%;">
  3. <view class="title">
  4. <!-- 头像 -->
  5. <image :src="img" style="width: 100rpx;height: 100rpx;border-radius: 50%;"></image>
  6. <!-- 名字 -->
  7. <view style="font-size: 34rpx;font-weight: bold;margin-left: 30rpx;">{{name}}</view>
  8. <view class="cu-tag round bg-orange sm" v-if="remark!=null">{{remark}}</view>
  9. </view>
  10. <view style="height: 100rpx;background-color: #FFF;padding: 0 40rpx;font-size: 34rpx;font-weight: bold;" class="flex align-center">
  11. 通话记录 </view>
  12. <view v-for="(item,index) in list" :key="index" style="padding: 30rpx 30rpx;background-color: #FFF;border-top: 1rpx solid #d0d0d0;" class="flex justify-between align-end">
  13. <view>
  14. <view style="margin-bottom: 10rpx;">
  15. <text style="font-size: 28rpx;margin-right: 10rpx;">订单号:</text>
  16. <text style="font-size: 24rpx;">{{item.order}}</text>
  17. </view>
  18. <view >
  19. <text style="font-size: 28rpx;margin-right: 10rpx">拨入时间:</text>
  20. <text style="font-size: 24rpx;">{{item.time}}</text>
  21. </view>
  22. </view>
  23. <view style="height: 100%;">
  24. <text style="font-size: 28rpx;margin-right: 10rpx">通话时长:</text>
  25. <text style="font-size: 24rpx;">{{item.duration}}</text>
  26. </view>
  27. </view>
  28. </view>
  29. </view>
  30. </template>
  31. <script>
  32. export default {
  33. components: {
  34. },
  35. // onLoad() {
  36. // console.log(callObject)
  37. // this.img = callObject.img
  38. // this.name = callObject.name
  39. // this.getLists();
  40. // },
  41. onLoad: function(options) {
  42. let object = JSON.parse(options.callObject); //注意,此赋值方法不是微信官方赋值方法,页面奖无法获取数据
  43. console.log(object);
  44. this.img = object.img
  45. this.name = object.name
  46. this.id = object.id
  47. this.remark = object.remark
  48. this.getLists()
  49. },
  50. mounted() {
  51. },
  52. data() {
  53. return {
  54. id: 0,
  55. img: '',
  56. name: '',
  57. object: '',
  58. list: []
  59. }
  60. },
  61. methods: {
  62. getLists: async function() {
  63. console.log(this.id)
  64. let res = await this.$request.post("Doctor/user_call", {
  65. user_id: this.id
  66. });
  67. if (res.status == 0) {
  68. if (res.data.length != 0) {
  69. for (let k = 0; k < res.data.length; k++) {
  70. this.list.push({
  71. time: res.data[k].time,
  72. duration: this.getDuration(res.data[k].talk_time),
  73. order: res.data[k].order_sn
  74. })
  75. }
  76. }
  77. }
  78. console.log("res", res);
  79. },
  80. getDuration(second) {
  81. // var hours = Math.floor((second % 86400) / 3600);
  82. // var minutes = Math.floor(((second % 86400) % 3600) / 60);
  83. // var seconds = Math.floor(((second % 86400) % 3600) % 60);
  84. // var duration = hours + ":" + minutes + ":" + seconds;
  85. // return duration;
  86. var theTime = parseInt(second);// 需要转换的时间秒
  87. var theTime1 = 0;// 分
  88. var theTime2 = 0;// 小时
  89. var theTime3 = 0;// 天
  90. if(theTime > 60) {
  91. theTime1 = parseInt(theTime/60);
  92. theTime = parseInt(theTime%60);
  93. if(theTime1 > 60) {
  94. theTime2 = parseInt(theTime1/60);
  95. theTime1 = parseInt(theTime1%60);
  96. if(theTime2 > 24){
  97. //大于24小时
  98. theTime3 = parseInt(theTime2/24);
  99. theTime2 = parseInt(theTime2%24);
  100. }
  101. }
  102. }
  103. var result = '';
  104. if(theTime > 0){
  105. result = ""+parseInt(theTime)+"秒";
  106. }
  107. if(theTime1 > 0) {
  108. result = ""+parseInt(theTime1)+"分"+result;
  109. }
  110. if(theTime2 > 0) {
  111. result = ""+parseInt(theTime2)+"小时"+result;
  112. }
  113. if(theTime3 > 0) {
  114. result = ""+parseInt(theTime3)+"天"+result;
  115. }
  116. return result;
  117. }
  118. }
  119. };
  120. </script>
  121. <style>
  122. .title {
  123. display: flex;
  124. align-items: center;
  125. border-radius: 30rpx;
  126. margin: 30rpx 50rpx;
  127. padding: 20rpx;
  128. box-shadow: 0 0 50rpx 0 rgba(0, 0, 0, 0.1);
  129. }
  130. </style>