index.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. <template>
  2. <view class="page">
  3. <view class="sheet">
  4. <uv-list border>
  5. <uv-list-item
  6. border
  7. :title="item.title"
  8. clickable
  9. show-arrow
  10. @click="handleClickFaq(item)"
  11. :note="item.createTime"
  12. v-for="(item, index) in state.feedbackList" :key="index">
  13. <template #footer>
  14. <uv-tags text="已反馈" plain size="mini" type="warning" v-if="item.replyContent"></uv-tags>
  15. <uv-tags text="待反馈" plain size="mini" type="primary" v-else></uv-tags>
  16. </template>
  17. </uv-list-item>
  18. </uv-list>
  19. </view>
  20. <view
  21. class="flex-center flex-column contact mt-20"
  22. hover-class="hover-scale"
  23. @click="call"
  24. >
  25. <image
  26. @click="handleCallPhone"
  27. class="width-96"
  28. mode="widthFix"
  29. src="/static/contact-customer.png"/>
  30. <view class="mt-16 color-666 fs-28">电话客服</view>
  31. </view>
  32. <view class="feedback-plus" @click="handleAddFeedback">
  33. <uv-icon name="plus" color="#fff"></uv-icon>
  34. </view>
  35. <add ref="add_ref" @refresh="loadDataList"></add>
  36. <add ref="detail_ref"></add>
  37. </view>
  38. </template>
  39. <script setup lang="ts">
  40. import {onHide, onShow} from "@dcloudio/uni-app";
  41. import {reactive, ref} from "vue";
  42. import {body} from "@/utils/https"
  43. import add from '@/pages-user/feedback/add.vue';
  44. import {getServicePhone} from "@/utils/common";
  45. const add_ref = ref()
  46. const detail_ref = ref()
  47. const initState = () => ({
  48. feedbackList: [
  49. // {
  50. // title: '洗车扣费异常问题',
  51. // status: 1,
  52. // createTime: '2022-09-01 10:00:00',
  53. // },
  54. // {
  55. // title: '洗车扣费异常问题',
  56. // status: 1,
  57. // createTime: '2022-09-01 10:00:00',
  58. // }
  59. ] as any[],
  60. servicerPhone: "",
  61. })
  62. const state = reactive(initState())
  63. const call = () => {
  64. uni.makePhoneCall({
  65. phoneNumber: state.servicerPhone,
  66. });
  67. };
  68. const toggle = (index: number) => {
  69. state.feedbackList = state.feedbackList.map((item, i) => {
  70. return {
  71. ...item,
  72. open: item.open ? false : i === index,
  73. };
  74. });
  75. };
  76. onShow(() => {
  77. let gd = getApp<any>().globalData;
  78. console.log(gd)
  79. state.servicerPhone = getServicePhone();
  80. // getApp<any>().globalData.config?.servicePhone;
  81. loadDataList()
  82. });
  83. const handleCallPhone = () => {
  84. let servicePhone = getServicePhone();
  85. uni.makePhoneCall({
  86. phoneNumber: servicePhone,
  87. fail: (error) => {
  88. console.log(error)
  89. }
  90. });
  91. }
  92. const loadDataList = () => {
  93. body(`/feedback/list`).then((res: any) => {
  94. state.feedbackList = res.list;
  95. })
  96. }
  97. onHide(() => {
  98. Object.assign(state, initState());
  99. })
  100. const handleClickFaq = (item: any) => {
  101. detail_ref.value?.open(item, 'detail')
  102. }
  103. const handleAddFeedback = () => {
  104. add_ref.value?.open(null, 'add');
  105. }
  106. </script>
  107. <style lang="scss">
  108. .page {
  109. min-height: 100vh;
  110. background: #f6f7fa;
  111. box-sizing: border-box;
  112. padding: 40rpx 32rpx;
  113. }
  114. .contact {
  115. height: 216rpx;
  116. border-radius: 24rpx;
  117. background: #fff;
  118. }
  119. .sheet {
  120. box-sizing: border-box;
  121. border-radius: 24rpx;
  122. background: #fff;
  123. overflow: hidden;
  124. &_bar {
  125. .head {
  126. padding: 0rpx 24rpx;
  127. box-sizing: border-box;
  128. & > view {
  129. border-bottom: 1rpx solid rgba(0, 0, 0, 0.1);
  130. }
  131. }
  132. .body {
  133. box-sizing: border-box;
  134. background-color: rgba(52, 125, 255, 0.06);
  135. transition: all 0.3s;
  136. padding: 0rpx 24rpx;
  137. }
  138. .body-hidden {
  139. height: 0px;
  140. overflow: hidden;
  141. }
  142. .body-open {
  143. height: auto;
  144. padding-top: 24rpx;
  145. padding-bottom: 24rpx;
  146. }
  147. &:last-child {
  148. .head {
  149. & > view {
  150. border-bottom: none;
  151. }
  152. }
  153. }
  154. }
  155. }
  156. .feedback-plus {
  157. position: fixed;
  158. bottom: 60rpx;
  159. right: 60rpx;
  160. width: 90rpx;
  161. height: 90rpx;
  162. background: $uni-color-primary;
  163. border-radius: 50%;
  164. display: flex;
  165. justify-content: center;
  166. align-items: center;
  167. box-shadow: 0px 4px 20px rgba(0, 0, 0, 0.1);
  168. z-index: 9999;
  169. }
  170. </style>