index.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. <template>
  2. <van-dialog
  3. v-model:show="isShowContact"
  4. :show-confirm-button="false"
  5. class="contact-dialog"
  6. :show-cancel-button="false"
  7. >
  8. <!-- 联系方式 -->
  9. <div class="contact-content">
  10. <div class="title">联系我们</div>
  11. <div class="contact">
  12. <div class="code-box">
  13. <img :src="imgUrl + '&key=' + contantDetail.wechatQrCode" alt="" />
  14. <div class="title">客户微信二维码</div>
  15. </div>
  16. <div class="phone-box">
  17. <img :src="parseImgUrl('ipdImages', 'phone-icon.svg')" alt="" />
  18. <div class="title">{{ contantDetail.phone }}</div>
  19. <div class="concat-text">客户电话联系方式</div>
  20. </div>
  21. </div>
  22. <buttons class="dailog-btn" @click="closeDailog">我知道了</buttons>
  23. </div>
  24. </van-dialog>
  25. </template>
  26. <script lang="ts">
  27. import {
  28. defineComponent,
  29. reactive,
  30. toRefs,
  31. onBeforeMount,
  32. onMounted,
  33. ref,
  34. watch,
  35. getCurrentInstance,
  36. } from "vue";
  37. import { Loading, Dialog, Toast } from "vant";
  38. import { getUserInfo, parseImgUrl } from "@/utils";
  39. import { queryCustomerservice } from "@/apis/envmonitor";
  40. const userInfo: any = getUserInfo();
  41. export default defineComponent({
  42. props: {
  43. isShowContact: {
  44. type: Boolean,
  45. default: () => false,
  46. },
  47. },
  48. components: {
  49. VanLoading: Loading,
  50. [Dialog.Component.name]: Dialog.Component,
  51. },
  52. setup(props, contx) {
  53. const contantDetail: any = {};
  54. const proxyGlobal: any = getCurrentInstance();
  55. const proxyData = reactive({
  56. parseImgUrl: parseImgUrl,
  57. contantDetail: contantDetail,
  58. userInfo: userInfo,
  59. imgUrl: proxyGlobal.proxy.$imgUrl,
  60. isShowContact: props.isShowContact,
  61. closeDailog() {
  62. contx.emit("closeDailog");
  63. },
  64. // 查询联系方式
  65. queryCustomerservice() {
  66. let params: any = {
  67. criteria: { projectId: proxyData.userInfo.projectId },
  68. };
  69. queryCustomerservice(params).then((res) => {
  70. let resData: any = res;
  71. let content: any = resData?.content ?? [];
  72. proxyData.contantDetail = content[0];
  73. });
  74. },
  75. });
  76. watch(
  77. props,
  78. (newProps: any) => {
  79. proxyData.isShowContact = newProps.isShowContact;
  80. },
  81. {
  82. deep: false,
  83. immediate: true,
  84. }
  85. );
  86. onMounted(() => {
  87. proxyData.queryCustomerservice();
  88. });
  89. return {
  90. ...toRefs(proxyData),
  91. };
  92. },
  93. });
  94. </script>
  95. <style lang="scss">
  96. .contact-dialog {
  97. width: 680px !important;
  98. height: 420px !important;
  99. background: #ffffff;
  100. border-radius: 32px;
  101. .van-dialog__content {
  102. width: 100%;
  103. height: 100%;
  104. }
  105. .contact-content {
  106. position: relative;
  107. width: 100%;
  108. height: 100%;
  109. .title {
  110. font-family: "PingFang SC";
  111. font-style: normal;
  112. font-weight: 500;
  113. font-size: 22px;
  114. line-height: 31px;
  115. text-align: center;
  116. padding: 30px;
  117. color: #000000;
  118. }
  119. .dailog-btn {
  120. position: absolute;
  121. bottom: 38px;
  122. width: 335px;
  123. left: 50%;
  124. transform: translateX(-50%);
  125. height: 50px;
  126. line-height: 50px;
  127. text-align: center;
  128. background: #ffffff;
  129. border: 1px solid #c3c7cb;
  130. border-radius: 25px;
  131. }
  132. }
  133. .contact {
  134. display: flex;
  135. height: 182px;
  136. .code-box {
  137. flex: 1;
  138. border-right: 1px solid #d9d9d9;
  139. text-align: center;
  140. color: #1F2429;
  141. img {
  142. width: 134px;
  143. height: 134px;
  144. // margin-bottom: 17px;
  145. }
  146. .title {
  147. color: #1f2429;
  148. font-family: "Noto Sans SC";
  149. font-style: normal;
  150. font-weight: 400;
  151. font-size: 14px;
  152. // line-height: 20px;
  153. text-align: center;
  154. }
  155. }
  156. .phone-box {
  157. flex: 1;
  158. text-align: center;
  159. .title {
  160. font-family: "Montserrat";
  161. font-style: normal;
  162. font-weight: 500;
  163. font-size: 24px;
  164. // line-height: 29px;
  165. margin-top: -15px;
  166. color: #af810c;
  167. }
  168. img {
  169. width: 100px;
  170. height: 100px;
  171. }
  172. .concat-text {
  173. margin-top: -10px;
  174. }
  175. }
  176. }
  177. }
  178. </style>