Просмотр исходного кода

新增:微信小程序端在线客服支持发送商品卡片

萤火科技 2 лет назад
Родитель
Сommit
e57bb18dff
2 измененных файлов с 28 добавлено и 3 удалено
  1. 27 2
      components/customer-btn/index.vue
  2. 1 1
      pages/goods/detail.vue

+ 27 - 2
components/customer-btn/index.vue

@@ -1,8 +1,12 @@
 <template>
 <template>
   <view v-if="isShow">
   <view v-if="isShow">
-    <button class="btn-normal" :open-type="setting.provider == 'mpwxkf' ? 'contact' : ''">
+    <!-- 微信小程序端、H5端、APP端 -->
+    <!-- #ifdef MP-WEIXIN || H5 || APP-PLUS -->
+    <button class="btn-normal" :open-type="setting.provider == 'mpwxkf' ? 'contact' : ''" :show-message-card="showCard"
+      :send-message-path="cardPath" :send-message-title="cardTitle" :send-message-img="cardImage" @click="handleContact()">
       <slot></slot>
       <slot></slot>
     </button>
     </button>
+    <!-- #endif -->
   </view>
   </view>
 </template>
 </template>
 
 
@@ -11,7 +15,28 @@
   import SettingModel from '@/common/model/Setting'
   import SettingModel from '@/common/model/Setting'
 
 
   export default {
   export default {
-    props: {},
+    props: {
+      // 是否显示消息卡片
+      showCard: {
+        Type: Boolean,
+        default: false
+      },
+      // 消息卡片标题
+      cardTitle: {
+        Type: String,
+        default: ''
+      },
+      // 消息卡片图片
+      cardImage: {
+        Type: String,
+        default: ''
+      },
+      // 消息卡片点击跳转的路径
+      cardPath: {
+        Type: String,
+        default: ''
+      },
+    },
     data() {
     data() {
       return {
       return {
         isShow: false,
         isShow: false,

+ 1 - 1
pages/goods/detail.vue

@@ -91,7 +91,7 @@
             </view>
             </view>
           </view>
           </view>
           <!-- 客服 -->
           <!-- 客服 -->
-          <customer-btn v-if="isShowCustomerBtn">
+          <customer-btn v-if="isShowCustomerBtn" :showCard="true" :cardTitle="goods.goods_name" :cardImage="goods.goods_image">
             <view class="fast-item">
             <view class="fast-item">
               <view class="fast-icon">
               <view class="fast-icon">
                 <text class="iconfont icon-kefu1"></text>
                 <text class="iconfont icon-kefu1"></text>