contact_offical.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. <template>
  2. <view class="contact-offical" v-show="isShow" :class="{ 'shop-contact': shopId }">
  3. <template v-if="shopId">
  4. <view class="header white">
  5. <view class="title font-size-50 text-center">店铺客服</view>
  6. <view class="line m-t-36"></view>
  7. </view>
  8. <view class="content flex-col col-center">
  9. <view class="content-view flex-col col-center bg-white text-center">
  10. <view class="flex col-center m-b-40 m-l-40" style="align-self: flex-start;">
  11. <u-image width="88rpx" height="88rpx" border-radius="50%" :src="server.shop.logo" />
  12. <view class="lg m-l-20">{{ server.shop.name }}</view>
  13. </view>
  14. <u-image width="360rpx" height="360rpx" :src="server.config.image" />
  15. <view v-if="server.config.wechat" class="flex row-center copy-btn white lg br60 m-t-50 m-b-40" @click="onCopy(server.config.wechat)">复制去微信添加</view>
  16. <view class="lighter xs">营业时间:{{ server.config.business_time }}</view>
  17. <view class="xs lighter m-t-10 flex">
  18. 客服电话:{{ server.config.phone }}
  19. <view class="phone-btn m-l-30" @tap="showPhoneCall = true">拨打</view>
  20. </view>
  21. </view>
  22. </view>
  23. <u-modal
  24. :content="'即将打电话给' + server.config.phone"
  25. v-model="showPhoneCall"
  26. show-cancel-button
  27. confirm-text="呼叫"
  28. :confirm-color="colorConfig.primary"
  29. @confirm="onCall"
  30. ></u-modal>
  31. </template>
  32. <template v-else>
  33. <view class="header white">
  34. <view class="title font-size-50 text-center">平台客服</view>
  35. <view class="line m-t-36"></view>
  36. </view>
  37. <view class="content flex-col col-center">
  38. <view class="content-view flex-col col-center bg-white text-center">
  39. <u-image width="360rpx" height="360rpx" :src="server.image" />
  40. <view v-if="server.wechat" class="flex row-center copy-btn lg br60 white m-t-50 m-b-40" @click="onCopy(server.wechat)">复制去微信添加</view>
  41. <view class="lighter xs">营业时间:{{ server.business_time }}</view>
  42. <view class="xs lighter m-t-10 flex">
  43. 平台电话:{{ server.phone }}
  44. <view class="phone-btn m-l-30" @tap="showPhoneCall = true">拨打</view>
  45. </view>
  46. </view>
  47. </view>
  48. <u-modal
  49. :content="'即将打电话给' + server.phone"
  50. v-model="showPhoneCall"
  51. show-cancel-button
  52. confirm-text="呼叫"
  53. :confirm-color="colorConfig.primary"
  54. @confirm="onCall"
  55. ></u-modal>
  56. </template>
  57. </view>
  58. </template>
  59. <script>
  60. import { getService, getChatConfig } from '@/api/app';
  61. import { getShopService } from '@/api/shop';
  62. import { copy } from '@/utils/tools';
  63. export default {
  64. name: 'contactOffical',
  65. data() {
  66. return {
  67. server: {
  68. config: {},
  69. shop: {}
  70. },
  71. showPhoneCall: false,
  72. shopId: 0,
  73. isShow: false
  74. };
  75. },
  76. onLoad(opt) {
  77. console.log(opt, 'ss');
  78. this.shopId = Number(this.$Route.query.id);
  79. this.getServiceFun();
  80. },
  81. methods: {
  82. async getServiceFun() {
  83. const { data, code } = this.shopId ? await getShopService(this.shopId) : await getService();
  84. if (code == 1) {
  85. this.server = data;
  86. this.isShow = true;
  87. }
  88. },
  89. onCopy(str) {
  90. copy(str);
  91. },
  92. onCall() {
  93. wx.makePhoneCall({
  94. phoneNumber: String((this.server.config && this.server.config.phone) || this.server.phone),
  95. success(e) {
  96. console.log('成功', e);
  97. },
  98. fail(err) {
  99. console.log('失败', err);
  100. }
  101. });
  102. }
  103. }
  104. };
  105. </script>
  106. <style lang="scss">
  107. page {
  108. padding: 0;
  109. }
  110. .contact-offical {
  111. min-height: 100vh;
  112. background-image: url(../../static/contact_official_bg.png);
  113. background-position: center;
  114. background-size: cover;
  115. background-repeat: no-repeat;
  116. &.shop-contact {
  117. background-image: url(../../static/shop_official_bg.png);
  118. .header {
  119. .line {
  120. background: #3a67e4;
  121. }
  122. }
  123. }
  124. .header {
  125. padding: 80rpx 50rpx 0;
  126. .line {
  127. height: 25rpx;
  128. background: #be000e;
  129. border-radius: 20rpx;
  130. }
  131. }
  132. .content {
  133. margin-top: -10rpx;
  134. .content-view {
  135. width: 620rpx;
  136. padding: 80rpx 20rpx 40rpx;
  137. }
  138. .phone-btn {
  139. padding: 2rpx 19rpx;
  140. border: 1px solid #d7d7d7;
  141. border-radius: 10rpx;
  142. }
  143. .copy-btn {
  144. background: linear-gradient(#12c96e 0%, #0abd57 50.76%, #03b240 100%);
  145. width: 460rpx;
  146. height: 84rpx;
  147. box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.16);
  148. }
  149. }
  150. }
  151. </style>