组件优化、支付宝客服适配

master
gongfuxiang 2021-11-18 12:39:54 +08:00
parent e9148565de
commit 462e636f51
7 changed files with 202 additions and 162 deletions

View File

@ -1,8 +1,10 @@
<template>
<view v-if="propNumber > 0" class="am-badge">
<view :class="'am-badge-text ' + ((propNumber > 99) ? 'am-badge-text-max' : '')">
<text>{{(propNumber > 99) ? '99+' : propNumber}}</text>
</view>
<template>
<view>
<view v-if="propNumber > 0" class="am-badge">
<view :class="'am-badge-text ' + ((propNumber > 99) ? 'am-badge-text-max' : '')">
<text>{{(propNumber > 99) ? '99+' : propNumber}}</text>
</view>
</view>
</view>
</template>
<script>
@ -11,8 +13,11 @@
return {};
},
components: {},
props: {
propNumber: Number
props: {
propNumber: {
type:[Number,String],
default: 0
}
},
methods: {}
};

View File

@ -1,8 +1,10 @@
<template>
<view v-if="(propStatus || false)" class="data-bottom-line">
<view class="left"></view>
<view class="msg">{{propMsg || '我是有底线的'}}</view>
<view class="right"></view>
<template>
<view>
<view v-if="(propStatus || false)" class="data-bottom-line">
<view class="left"></view>
<view class="msg">{{propMsg || '我是有底线的'}}</view>
<view class="right"></view>
</view>
</view>
</template>
<script>

View File

@ -1,6 +1,8 @@
<template>
<view class="copyright">
<view class="text">Powered by ShopXO {{version}}</view>
<view>
<view class="copyright">
<view class="text">Powered by ShopXO {{version}}</view>
</view>
</view>
</template>
<script>

View File

@ -1,6 +1,6 @@
<template>
<view v-if="propData.length > 0">
<view class="data-list">
<view>
<view v-if="propData.length > 0" class="data-list">
<view v-for="(item, index) in propData" :key="index" class="items">
<view class="items-content" :data-value="item.event_value" :data-type="item.event_type" @tap="navigation_event" :style="'background-color:' + (item.bg_color || '#fff')">
<image :src="item.images_url" mode="aspectFit"></image>

View File

@ -1,163 +1,165 @@
<template>
<block v-if="(propData || null) != null && propData.length > 0">
<block v-for="(v, index) in propData" :key="index">
<view v-if="(v.value || null) != null && (v.children || null) != null && v.children.length > 0 && (v.value_arr || null) != null && v.value_arr.length > 0 && v.children.length == v.value_arr.length && (v.status || 0) == 1"
class="layout-view">
<view :class="'layout-content-children ' + (((v.config || null) != null && (v.config.frontend_config || null) != null && (v.config.frontend_config.ent || null) != null) ? v.config.frontend_config.ent : '')"
:style="((v.config || null) != null && (v.config.frontend_config || null) != null && (v.config.frontend_config.style || null) != null) ? v.config.frontend_config.style : ''">
<block v-for="(vs, index2) in v.children" :key="index2">
<view :class="'layout-content-container ' + (((vs.config || null) != null && (vs.config.frontend_config || null) != null && (vs.config.frontend_config.ent || null) != null) ? vs.config.frontend_config.ent : '')"
:style="((vs.config || null) != null && (vs.config.frontend_config || null) != null && (vs.config.frontend_config.style || null) != null) ? vs.config.frontend_config.style : ''">
<block v-if="(vs.children || null) != null && vs.children.length > 0">
<view v-for="(vss, index) in vs.children" :key="index" class="layout-content">
<view v-if="(vss.config || null) != null" class="module-content">
<view :class="'module-' + vss.value + '-container'" :style="((vss.config.frontend_config || null) != null && (vss.config.frontend_config.style || null) != null) ? vss.config.frontend_config.style : ''">
<!-- 单图 -->
<block v-if="vss.value == 'images'">
<view :class="'module-images-content ' + vss.config.frontend_config.media_fixed.media_container_ent"
:style="vss.config.frontend_config.media_fixed.media_container_style">
<image @tap="layout_url_event" :data-value="vss.config.url || ''" :src="vss.config.images"
mode="widthFix" :class="vss.config.frontend_config.media_fixed.media_ent">
</image>
</view>
</block>
<!-- 多图 -->
<block v-else-if="vss.value == 'many-images'">
<block v-if="vss.config.view_list_show_style == 'rolling'">
<!-- 滚动 -->
<view class="module-list-rolling">
<scroll-view scroll-x>
<view v-for="(item, index2) in vss.config.data_list" :key="index2" class="item">
<view :class="'module-item ' + vss.config.frontend_config.media_fixed.media_container_ent"
:style="'width:' + (((vss.config.view_list_show_style_value_arr || null) == null || (vss.config.view_list_show_style_value_arr.item_width || null) == null) ? 200 : vss.config.view_list_show_style_value_arr.item_width) + 'px;margin-left:' + (((vss.config.view_list_show_style_value_arr || null) == null || (vss.config.view_list_show_style_value_arr.item_margin || null) == null || index2 == 0) ? 0 : vss.config.view_list_show_style_value_arr.item_margin) + 'px;' + vss.config.frontend_config.item_style + '' + vss.config.frontend_config.media_fixed.media_container_style"
@tap="layout_url_event" :data-value="item.url || ''">
<image :src="item.images" mode="widthFix" :class="vss.config.frontend_config.media_fixed.media_ent">
</image>
</view>
</view>
</scroll-view>
<view>
<block v-if="(propData || null) != null && propData.length > 0">
<block v-for="(v, index) in propData" :key="index">
<view v-if="(v.value || null) != null && (v.children || null) != null && v.children.length > 0 && (v.value_arr || null) != null && v.value_arr.length > 0 && v.children.length == v.value_arr.length && (v.status || 0) == 1"
class="layout-view">
<view :class="'layout-content-children ' + (((v.config || null) != null && (v.config.frontend_config || null) != null && (v.config.frontend_config.ent || null) != null) ? v.config.frontend_config.ent : '')"
:style="((v.config || null) != null && (v.config.frontend_config || null) != null && (v.config.frontend_config.style || null) != null) ? v.config.frontend_config.style : ''">
<block v-for="(vs, index2) in v.children" :key="index2">
<view :class="'layout-content-container ' + (((vs.config || null) != null && (vs.config.frontend_config || null) != null && (vs.config.frontend_config.ent || null) != null) ? vs.config.frontend_config.ent : '')"
:style="((vs.config || null) != null && (vs.config.frontend_config || null) != null && (vs.config.frontend_config.style || null) != null) ? vs.config.frontend_config.style : ''">
<block v-if="(vs.children || null) != null && vs.children.length > 0">
<view v-for="(vss, index) in vs.children" :key="index" class="layout-content">
<view v-if="(vss.config || null) != null" class="module-content">
<view :class="'module-' + vss.value + '-container'" :style="((vss.config.frontend_config || null) != null && (vss.config.frontend_config.style || null) != null) ? vss.config.frontend_config.style : ''">
<!-- 单图 -->
<block v-if="vss.value == 'images'">
<view :class="'module-images-content ' + vss.config.frontend_config.media_fixed.media_container_ent"
:style="vss.config.frontend_config.media_fixed.media_container_style">
<image @tap="layout_url_event" :data-value="vss.config.url || ''" :src="vss.config.images"
mode="widthFix" :class="vss.config.frontend_config.media_fixed.media_ent">
</image>
</view>
</block>
<block v-else-if="vss.config.view_list_show_style == 'list'">
<!-- 列表 -->
<view :class="'module-list-content ' + vss.config.frontend_config.list_ent">
<view v-for="(item, index2) in vss.config.data_list" :key="index2" class="item">
<view class="module-item" :style="vss.config.frontend_config.item_style">
<view :class="vss.config.frontend_config.media_fixed.media_container_ent"
:style="vss.config.frontend_config.media_fixed.media_container_style" @tap="layout_url_event"
:data-value="item.url || ''">
<image :src="item.images" mode="widthFix" :class="vss.config.frontend_config.media_fixed.media_ent">
</image>
</view>
</view>
</view>
</view>
</block>
<block v-else>
<!-- 默认轮播 -->
<swiper :indicator-dots="vss.config.data_list.length > 0" :indicator-color="indicator_color"
:indicator-active-color="indicator_active_color" :autoplay="vss.config.data_list.length > 0"
:circular="circular" :style="vss.config.frontend_config.media_fixed.media_container_style">
<block v-for="(item, index2) in vss.config.data_list" :key="index2">
<swiper-item :class="vss.config.frontend_config.media_fixed.media_container_ent">
<image :src="item.images" mode="aspectFill" :class="vss.config.frontend_config.media_fixed.media_ent"
@tap="layout_url_event" :data-value="item.url || ''">
</image>
</swiper-item>
</block>
</swiper>
</block>
</block>
<!-- 视频 -->
<block v-else-if="vss.value == 'video'">
<view :class="'module-video-content ' + vss.config.frontend_config.media_fixed.media_container_ent"
:style="vss.config.frontend_config.media_fixed.media_container_style">
<video :src="vss.config.video" :autoplay="false" :show-center-play-btn="true"
:controls="false" :show-play-btn="false" :enable-progress-gesture="false"
:show-fullscreen-btn="false" :poster="(vss.config.content_images || null) != null ? vss.config.content_images : ''"
:class="vss.config.frontend_config.media_fixed.media_ent">
</video>
</view>
</block>
<!-- 商品 -->
<block v-else-if="vss.value == 'goods'">
<block v-if="(vss.config.data_list || null) != null && vss.config.data_list.length > 0">
<!-- 多图 -->
<block v-else-if="vss.value == 'many-images'">
<block v-if="vss.config.view_list_show_style == 'rolling'">
<!-- 滚动 -->
<view class="module-goods-content module-list-rolling">
<view class="module-list-rolling">
<scroll-view scroll-x>
<view v-for="(item, index2) in vss.config.data_list" :key="index2" class="item">
<view :class="'module-item ' + vss.config.frontend_config.media_fixed.media_container_ent"
:style="'width:' + (((vss.config.view_list_show_style_value_arr || null) == null || (vss.config.view_list_show_style_value_arr.item_width || null) == null) ? 200 : vss.config.view_list_show_style_value_arr.item_width) + 'px;margin-left:' + (((vss.config.view_list_show_style_value_arr || null) == null || (vss.config.view_list_show_style_value_arr.item_margin || null) == null || index2 == 0) ? 0 : vss.config.view_list_show_style_value_arr.item_margin) + 'px;' + vss.config.frontend_config.item_style + '' + vss.config.frontend_config.media_fixed.media_container_style"
@tap="layout_url_event" :data-value="item.goods_url || ''">
@tap="layout_url_event" :data-value="item.url || ''">
<image :src="item.images" mode="widthFix" :class="vss.config.frontend_config.media_fixed.media_ent">
</image>
<view class="item-bottom">
<view class="module-title">
{{item.title}}
</view>
<view class="module-price">
{{currency_symbol}}{{item.price}}
</view>
</view>
</view>
</view>
</scroll-view>
</view>
</block>
<block v-else>
<!-- 默认列表 -->
<view :class="'module-goods-content module-list-content ' + vss.config.frontend_config.list_ent">
<block v-else-if="vss.config.view_list_show_style == 'list'">
<!-- 列表 -->
<view :class="'module-list-content ' + vss.config.frontend_config.list_ent">
<view v-for="(item, index2) in vss.config.data_list" :key="index2" class="item">
<view class="module-item" :style="vss.config.frontend_config.item_style">
<view :class="vss.config.frontend_config.media_fixed.media_container_ent"
:style="vss.config.frontend_config.media_fixed.media_container_style" @tap="layout_url_event"
:data-value="item.goods_url || ''">
:data-value="item.url || ''">
<image :src="item.images" mode="widthFix" :class="vss.config.frontend_config.media_fixed.media_ent">
</image>
<view class="item-bottom">
<view class="module-title">
{{item.title}}
</view>
<view class="module-price">
{{currency_symbol}}{{item.price}}
</view>
</view>
</view>
</view>
</view>
</view>
</block>
<block v-else>
<!-- 默认轮播 -->
<swiper :indicator-dots="vss.config.data_list.length > 0" :indicator-color="indicator_color"
:indicator-active-color="indicator_active_color" :autoplay="vss.config.data_list.length > 0"
:circular="circular" :style="vss.config.frontend_config.media_fixed.media_container_style">
<block v-for="(item, index2) in vss.config.data_list" :key="index2">
<swiper-item :class="vss.config.frontend_config.media_fixed.media_container_ent">
<image :src="item.images" mode="aspectFill" :class="vss.config.frontend_config.media_fixed.media_ent"
@tap="layout_url_event" :data-value="item.url || ''">
</image>
</swiper-item>
</block>
</swiper>
</block>
</block>
</block>
<!-- 标题 -->
<block v-else-if="vss.value == 'title'">
<view class="module-title-content">
<text class="title-main" :style="vss.config.frontend_config.style_title_main">
{{vss.config.title}}
</text>
<text v-if="(vss.config.title_vice || null) != null" class="title-vice"
:style="vss.config.frontend_config.style_title_vice">
{{vss.config.title_vice}}
</text>
<view v-if="(vss.config.title_more || null) != null" class="more-content">
<view :style="vss.config.frontend_config.style_title_more" @tap="layout_url_event"
:data-value="vss.config.title_more_url || ''">
{{vss.config.title_more}} >
<!-- 视频 -->
<block v-else-if="vss.value == 'video'">
<view :class="'module-video-content ' + vss.config.frontend_config.media_fixed.media_container_ent"
:style="vss.config.frontend_config.media_fixed.media_container_style">
<video :src="vss.config.video" :autoplay="false" :show-center-play-btn="true"
:controls="false" :show-play-btn="false" :enable-progress-gesture="false"
:show-fullscreen-btn="false" :poster="(vss.config.content_images || null) != null ? vss.config.content_images : ''"
:class="vss.config.frontend_config.media_fixed.media_ent">
</video>
</view>
</block>
<!-- 商品 -->
<block v-else-if="vss.value == 'goods'">
<block v-if="(vss.config.data_list || null) != null && vss.config.data_list.length > 0">
<block v-if="vss.config.view_list_show_style == 'rolling'">
<!-- 滚动 -->
<view class="module-goods-content module-list-rolling">
<scroll-view scroll-x>
<view v-for="(item, index2) in vss.config.data_list" :key="index2" class="item">
<view :class="'module-item ' + vss.config.frontend_config.media_fixed.media_container_ent"
:style="'width:' + (((vss.config.view_list_show_style_value_arr || null) == null || (vss.config.view_list_show_style_value_arr.item_width || null) == null) ? 200 : vss.config.view_list_show_style_value_arr.item_width) + 'px;margin-left:' + (((vss.config.view_list_show_style_value_arr || null) == null || (vss.config.view_list_show_style_value_arr.item_margin || null) == null || index2 == 0) ? 0 : vss.config.view_list_show_style_value_arr.item_margin) + 'px;' + vss.config.frontend_config.item_style + '' + vss.config.frontend_config.media_fixed.media_container_style"
@tap="layout_url_event" :data-value="item.goods_url || ''">
<image :src="item.images" mode="widthFix" :class="vss.config.frontend_config.media_fixed.media_ent">
</image>
<view class="item-bottom">
<view class="module-title">
{{item.title}}
</view>
<view class="module-price">
{{currency_symbol}}{{item.price}}
</view>
</view>
</view>
</view>
</scroll-view>
</view>
</block>
<block v-else>
<!-- 默认列表 -->
<view :class="'module-goods-content module-list-content ' + vss.config.frontend_config.list_ent">
<view v-for="(item, index2) in vss.config.data_list" :key="index2" class="item">
<view class="module-item" :style="vss.config.frontend_config.item_style">
<view :class="vss.config.frontend_config.media_fixed.media_container_ent"
:style="vss.config.frontend_config.media_fixed.media_container_style" @tap="layout_url_event"
:data-value="item.goods_url || ''">
<image :src="item.images" mode="widthFix" :class="vss.config.frontend_config.media_fixed.media_ent">
</image>
<view class="item-bottom">
<view class="module-title">
{{item.title}}
</view>
<view class="module-price">
{{currency_symbol}}{{item.price}}
</view>
</view>
</view>
</view>
</view>
</view>
</block>
</block>
</block>
<!-- 标题 -->
<block v-else-if="vss.value == 'title'">
<view class="module-title-content">
<text class="title-main" :style="vss.config.frontend_config.style_title_main">
{{vss.config.title}}
</text>
<text v-if="(vss.config.title_vice || null) != null" class="title-vice"
:style="vss.config.frontend_config.style_title_vice">
{{vss.config.title_vice}}
</text>
<view v-if="(vss.config.title_more || null) != null" class="more-content">
<view :style="vss.config.frontend_config.style_title_more" @tap="layout_url_event"
:data-value="vss.config.title_more_url || ''">
{{vss.config.title_more}} >
</view>
</view>
</view>
</view>
</block>
</block>
</view>
</view>
</view>
</view>
</block>
</view>
</block>
</block>
</view>
</block>
</view>
</view>
</view>
</block>
</block>
</block>
</view>
</template>
<script>
const app = getApp();

View File

@ -1,15 +1,18 @@
<template>
<view>
<!-- #ifdef MP-WEIXIN || MP-TOUTIAO || MP-BAIDU || MP-ALIPAY -->
<!-- 开启事件 -->
<movable-area v-if="online_service_status == 1" class="online-service-movable-container" :style="'height: calc(100% - '+top+'rpx);top:'+top+'rpx;'">
<movable-view direction="all" :x="x" :y="y" :animation="false" class="online-service-event-submit">
<button :class="common_ent" open-type="contact" :show-message-card="propCard" :send-message-title="propTitle" :send-message-path="propPath" :send-message-img="propImg">
<image :src="common_static_url+'online-service-icon.png'" class="dis-block"></image>
</button>
</movable-view>
</movable-area>
<!-- #endif -->
<!-- 开启事件 -->
<movable-area v-if="online_service_status == 1" class="online-service-movable-container" :style="'height: calc(100% - '+top+'rpx);top:'+top+'rpx;'">
<movable-view direction="all" :x="x" :y="y" :animation="false" class="online-service-event-submit">
<button :class="common_ent" open-type="contact" :show-message-card="propCard" :send-message-title="propTitle" :send-message-path="propPath" :send-message-img="propImg">
<!-- #ifdef MP-ALIPAY -->
<contact-button :tnt-inst-id="mini_alipay_tnt_inst_id" :scene="mini_alipay_scene" :alipay-card-no="mini_alipay_openid || ''" :icon="common_static_url+'online-service-icon.png'" size="60rpx*60rpx" />
<!-- #endif -->
<!-- #ifdef MP-WEIXIN || MP-TOUTIAO || MP-BAIDU -->
<image :src="common_static_url+'online-service-icon.png'" class="dis-block"></image>
<!-- #endif -->
</button>
</movable-view>
</movable-area>
</view>
</template>
<script>
@ -19,7 +22,10 @@
data() {
return {
common_static_url: common_static_url,
online_service_status: 0,
online_service_status: 0,
mini_alipay_tnt_inst_id: null,
mini_alipay_scene: null,
mini_alipay_openid: null,
system: null,
x: 0,
y: 0,
@ -86,10 +92,25 @@
methods: {
//
init_config(status) {
if ((status || false) == true) {
if ((status || false) == true) {
// #ifdef MP-WEIXIN || MP-TOUTIAO || MP-BAIDU || MP-ALIPAY
this.setData({
online_service_status: app.globalData.get_config('config.common_app_is_online_service') || 0
});
});
// #endif
// #ifdef MP-ALIPAY
// 线openid
if(this.online_service_status == 1)
{
this.setData({
mini_alipay_tnt_inst_id: app.globalData.get_config('config.common_app_mini_alipay_tnt_inst_id'),
mini_alipay_scene: app.globalData.get_config('config.common_app_mini_alipay_scene'),
mini_alipay_openid: app.globalData.get_user_cache_info('alipay_openid')
});
}
// #endif
console.log(this.mini_alipay_tnt_inst_id, this.mini_alipay_scene, this.mini_alipay_openid)
} else {
app.globalData.is_config(this, 'init_config');
}
@ -126,5 +147,11 @@
.online-service-event-submit image {
width: 60rpx !important;
height: 60rpx !important;
}
}
/* #ifdef MP-ALIPAY */
.online-service-event-submit contact-button {
line-height: initial;
display: block;
}
/* #endif */
</style>

View File

@ -1,9 +1,11 @@
<template>
<view :class="'popup ' + (propClassname || '') + ' ' + ((propShow || false) ? 'popup-show' : '') + ' ' + ((propAnimation || true) ? 'animation': '' )" :disable-scroll="propDisablescroll">
<view class="popup-mask" v-if="propMask || true" @tap="onMaskTap"></view>
<view :class="'popup-content popup-' + propPosition || 'bottom'">
<slot></slot>
</view>
<template>
<view>
<view :class="'popup ' + (propClassname || '') + ' ' + ((propShow || false) ? 'popup-show' : '') + ' ' + ((propAnimation || true) ? 'animation': '' )" :disable-scroll="propDisablescroll">
<view class="popup-mask" v-if="propMask || true" @tap="onMaskTap"></view>
<view :class="'popup-content popup-' + propPosition || 'bottom'">
<slot></slot>
</view>
</view>
</view>
</template>
<script>