新增商品对比入口
parent
5d0abf9bdd
commit
f32db940d8
|
|
@ -59,14 +59,12 @@
|
|||
<iconfont :name="'icon-zhifu-' + (item.selected || false ? 'yixuan' : 'weixuan')" size="40rpx" :color="item.selected || false ? theme_color : '#999'"></iconfont>
|
||||
</view>
|
||||
<view class="items oh padding-left-main flex-1 flex-row">
|
||||
<view>
|
||||
<view :data-index="index" :data-value="item.goods_url" @tap="goods_event" class="cp">
|
||||
<!-- 图片 -->
|
||||
<image :class="'cart-goods-image fl radius ' + ((item.is_error || 0) == 1 ? 'opacity' : '')" :src="item.images" mode="aspectFill"></image>
|
||||
<!-- 错误 -->
|
||||
<view v-if="(item.is_error || 0) == 1" class="error-msg pa tc text-size-xs">
|
||||
<text class="cr-red tc bg-white round">{{ item.error_msg }}</text>
|
||||
</view>
|
||||
<view :data-index="index" :data-value="item.goods_url" @tap="goods_event" class="cp">
|
||||
<!-- 图片 -->
|
||||
<image :class="'cart-goods-image fl radius ' + ((item.is_error || 0) == 1 ? 'opacity' : '')" :src="item.images" mode="aspectFill"></image>
|
||||
<!-- 错误 -->
|
||||
<view v-if="(item.is_error || 0) == 1" class="error-msg pa tc text-size-xs">
|
||||
<text class="cr-red tc bg-white round">{{ item.error_msg }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
<view :class="theme_view">
|
||||
<component-popup :propShow="popup_status" propPosition="bottom" @onclose="popup_close_event">
|
||||
<view class="emoji-popup bg-white">
|
||||
<view class="close fr oh">
|
||||
<view class="fr" @tap.stop="popup_close_event">
|
||||
<view class="close oh pa top-0 right-0 z-i-deep">
|
||||
<view class="fr padding-top padding-right padding-left-sm padding-bottom-sm" @tap.stop="popup_close_event">
|
||||
<iconfont name="icon-close-o" size="28rpx" color="#999"></iconfont>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -75,12 +75,6 @@
|
|||
padding: 20rpx 10rpx 0 10rpx;
|
||||
position: relative;
|
||||
}
|
||||
.emoji-popup .close {
|
||||
position: absolute;
|
||||
top: 20rpx;
|
||||
right: 20rpx;
|
||||
z-index: 2;
|
||||
}
|
||||
.emoji-popup-content {
|
||||
max-height: 50vh;
|
||||
overflow-y: scroll;
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
<view :class="theme_view">
|
||||
<component-popup :propShow="popup_status" propPosition="bottom" @onclose="popup_close_event">
|
||||
<view class="bg-white">
|
||||
<view class="close oh padding-horizontal-main padding-top-main">
|
||||
<view class="fr" @tap.stop="popup_close_event">
|
||||
<view class="close oh pa top-0 right-0 z-i-deep">
|
||||
<view class="fr padding-top padding-right padding-left-sm padding-bottom-sm" @tap.stop="popup_close_event">
|
||||
<iconfont name="icon-close-o" size="28rpx" color="#999"></iconfont>
|
||||
</view>
|
||||
</view>
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
<view :class="theme_view" class="z-i-deep">
|
||||
<component-popup :propShow="popup_status" propPosition="bottom" @onclose="popup_close_event" :propIndex="propIndex">
|
||||
<view class="goods-spec-choice-container padding-main bg-white pr">
|
||||
<view class="close fr oh">
|
||||
<view class="fr" @tap.stop="popup_close_event">
|
||||
<view class="close oh pa top-0 right-0 z-i-deep">
|
||||
<view class="fr padding-top padding-right padding-left-sm padding-bottom-sm" @tap.stop="popup_close_event">
|
||||
<iconfont name="icon-close-o" size="28rpx" color="#999"></iconfont>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -850,12 +850,6 @@
|
|||
};
|
||||
</script>
|
||||
<style>
|
||||
.goods-spec-choice-container .close {
|
||||
position: absolute;
|
||||
top: 20rpx;
|
||||
right: 20rpx;
|
||||
z-index: 2;
|
||||
}
|
||||
.goods-spec-base {
|
||||
height: 230rpx;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
<view :class="theme_view">
|
||||
<component-popup :propShow="popup_status" propPosition="bottom" @onclose="popup_close_event" :propIndex="propIndex">
|
||||
<view class="goods-spec-choice-container padding-main bg-white pr">
|
||||
<view class="close fr oh">
|
||||
<view class="fr" @tap.stop="popup_close_event">
|
||||
<view class="close oh pa top-0 right-0 z-i-deep">
|
||||
<view class="fr padding-top padding-right padding-left-sm padding-bottom-sm" @tap.stop="popup_close_event">
|
||||
<iconfont name="icon-close-o" size="28rpx" color="#999"></iconfont>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -319,12 +319,6 @@
|
|||
};
|
||||
</script>
|
||||
<style>
|
||||
.goods-spec-choice-container .close {
|
||||
position: absolute;
|
||||
top: 20rpx;
|
||||
right: 20rpx;
|
||||
z-index: 2;
|
||||
}
|
||||
.goods-spec-choice-content {
|
||||
max-height: 50vh;
|
||||
overflow-y: scroll;
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@
|
|||
<component-popup :propShow="popup_status" propPosition="bottom" @onclose="lang_close_event">
|
||||
<view class="lang-popup-container">
|
||||
<!--弹出框关闭按钮 -->
|
||||
<view class="close oh flex-row">
|
||||
<view class="fr" @tap="lang_close_event">
|
||||
<view class="close oh pa top-0 right-0 z-i-deep">
|
||||
<view class="fr padding-top padding-right padding-left-sm padding-bottom-sm" @tap="lang_close_event">
|
||||
<iconfont name="icon-close-o" size="28rpx" color="#999"></iconfont>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -105,13 +105,6 @@
|
|||
padding: 20rpx 10rpx 0 10rpx;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.lang-popup-container .close {
|
||||
position: absolute;
|
||||
top: 24rpx;
|
||||
right: 20rpx;
|
||||
z-index: 2;
|
||||
}
|
||||
.lang-popup-title {
|
||||
position: absolute;
|
||||
top: 20rpx;
|
||||
|
|
@ -120,12 +113,11 @@
|
|||
z-index: 2;
|
||||
font-size: 32rpx;
|
||||
}
|
||||
|
||||
.lang-popup-content {
|
||||
max-height: 80vh;
|
||||
overflow-y: scroll;
|
||||
overflow-x: hidden;
|
||||
padding: 50rpx 20rpx;
|
||||
padding: 60rpx 20rpx;
|
||||
padding-bottom: 40rpx;
|
||||
}
|
||||
.lang-popup-list {
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
<!-- 弹窗 -->
|
||||
<component-popup :propShow="popup_status" :propIsBar="propIsBar" propPosition="bottom" @onclose="quick_close_event">
|
||||
<view :class="'nav-popup-container ' + common_ent">
|
||||
<view class="close oh">
|
||||
<view class="close oh pa top-xxxxl right-xxxxl z-i-deep">
|
||||
<view class="fr" @tap.stop="quick_close_event">
|
||||
<iconfont name="icon-close-o" size="28rpx" color="#999"></iconfont>
|
||||
</view>
|
||||
|
|
@ -153,7 +153,7 @@
|
|||
},
|
||||
};
|
||||
</script>
|
||||
<style>
|
||||
<style scoped>
|
||||
/**
|
||||
* 按钮
|
||||
*/
|
||||
|
|
@ -193,14 +193,6 @@
|
|||
padding: 20rpx 10rpx 0 10rpx;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.nav-popup-container .close {
|
||||
position: absolute;
|
||||
top: 20rpx;
|
||||
right: 20rpx;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.nav-popup-content {
|
||||
max-height: 80vh;
|
||||
overflow-y: scroll;
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
<view :class="theme_view">
|
||||
<component-popup :propShow="popup_status" propPosition="bottom" @onclose="popup_close_event">
|
||||
<view class="share-popup bg-white">
|
||||
<view class="close fr oh">
|
||||
<view class="fr" @tap.stop="popup_close_event">
|
||||
<view class="close oh pa top-0 right-0 z-i-deep">
|
||||
<view class="fr padding-top padding-right padding-left-sm padding-bottom-sm" @tap.stop="popup_close_event">
|
||||
<iconfont name="icon-close-o" size="28rpx" color="#999"></iconfont>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -260,13 +260,6 @@
|
|||
padding: 20rpx 10rpx 0 10rpx;
|
||||
position: relative;
|
||||
}
|
||||
.share-popup .close {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
z-index: 2;
|
||||
padding: 20rpx;
|
||||
}
|
||||
.share-popup-content {
|
||||
padding: 0 20rpx;
|
||||
text-align: left;
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
<view :class="theme_view">
|
||||
<component-popup :propShow="popup_status" propPosition="bottom" @onclose="popup_close_event">
|
||||
<view :class="'user-base-popup bg-white ' + (propIsGrayscale ? 'grayscale' : '')">
|
||||
<view class="close fr oh">
|
||||
<view class="fr" @tap.stop="popup_close_event">
|
||||
<view class="close oh pa top-0 right-0 z-i-deep">
|
||||
<view class="fr padding-top padding-right padding-left-sm padding-bottom-sm" @tap.stop="popup_close_event">
|
||||
<iconfont name="icon-close-o" size="24rpx" color="#999"></iconfont>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -440,12 +440,6 @@
|
|||
padding: 36rpx;
|
||||
position: relative;
|
||||
}
|
||||
.user-base-popup .close {
|
||||
position: absolute;
|
||||
top: 36rpx;
|
||||
right: 36rpx;
|
||||
z-index: 2;
|
||||
}
|
||||
.user-base-avatar {
|
||||
width: 80rpx;
|
||||
height: 80rpx !important;
|
||||
|
|
|
|||
|
|
@ -15,10 +15,16 @@
|
|||
"save": "Preserve",
|
||||
"add": "Add",
|
||||
"copy": "Copy",
|
||||
"remove": "Remove",
|
||||
"remove_success": "Remove successful",
|
||||
"remove_fail": "Remove failed",
|
||||
"del": "Delete",
|
||||
"del_record": "Delete record",
|
||||
"del_success": "Delete successful",
|
||||
"del_fail": "Delete failed",
|
||||
"join": "Join",
|
||||
"join_success": "Join successful",
|
||||
"join_fail": "Join failed",
|
||||
"edit": "Edit",
|
||||
"link": "Link",
|
||||
"gift": "Gift",
|
||||
|
|
@ -271,7 +277,8 @@
|
|||
"plugins-hospital-prescription": "Consultation and prescription",
|
||||
"plugins-certificate-userauth": "Certificate",
|
||||
"plugins-certificate-userauth-saveinfo": "Certificate editor",
|
||||
"plugins-certificate-userauth-detail": "Certificate detail"
|
||||
"plugins-certificate-userauth-detail": "Certificate detail",
|
||||
"plugins-goodscompare-index": "Goods Compare"
|
||||
},
|
||||
"login": {
|
||||
"login": {
|
||||
|
|
@ -1097,7 +1104,6 @@
|
|||
"57zrl5": "icon",
|
||||
"3vk50b": "Suggest 100 * 100px",
|
||||
"5ws7m3": "Related products",
|
||||
"q536vp": "remove",
|
||||
"27goz3": "+Select product",
|
||||
"6rlju7": "Current Display",
|
||||
"q4qr64": "Title format: 1~60 characters",
|
||||
|
|
|
|||
|
|
@ -15,10 +15,16 @@
|
|||
"save": "保存",
|
||||
"add": "新增",
|
||||
"copy": "复制",
|
||||
"remove": "移除",
|
||||
"remove_success": "移除成功",
|
||||
"remove_fail": "移除失败",
|
||||
"del": "删除",
|
||||
"del_record": "删除记录",
|
||||
"del_success": "删除成功",
|
||||
"del_fail": "删除失败",
|
||||
"join": "加入",
|
||||
"join_success": "加入成功",
|
||||
"join_fail": "加入失败",
|
||||
"edit": "编辑",
|
||||
"link": "链接",
|
||||
"gift": "礼物",
|
||||
|
|
@ -269,7 +275,8 @@
|
|||
"plugins-hospital-prescription": "问诊开方",
|
||||
"plugins-certificate-userauth": "资质认证",
|
||||
"plugins-certificate-userauth-saveinfo": "资质认证编辑",
|
||||
"plugins-certificate-userauth-detail": "资质认证详情"
|
||||
"plugins-certificate-userauth-detail": "资质认证详情",
|
||||
"plugins-goodscompare-index": "商品对比"
|
||||
},
|
||||
"login": {
|
||||
"login": {
|
||||
|
|
@ -1085,7 +1092,6 @@
|
|||
"57zrl5": "图标",
|
||||
"3vk50b": "建议100*100px",
|
||||
"5ws7m3": "关联商品",
|
||||
"q536vp": "移除",
|
||||
"27goz3": "+ 选择商品",
|
||||
"6rlju7": "当前展示",
|
||||
"q4qr64": "标题格式1~60个字符",
|
||||
|
|
|
|||
18
pages.json
18
pages.json
|
|
@ -122,7 +122,8 @@
|
|||
"component-shop-list": "/pages/plugins/shop/components/shop-list/shop-list",
|
||||
"component-ask-comments-goods": "/pages/plugins/ask/components/ask-comments-goods/ask-comments-goods",
|
||||
"component-goods-comments": "/pages/goods-detail/components/goods-comments/goods-comments",
|
||||
"component-coupon-card": "/pages/plugins/coupon/components/coupon-card/coupon-card"
|
||||
"component-coupon-card": "/pages/plugins/coupon/components/coupon-card/coupon-card",
|
||||
"component-goods-compare": "/pages/plugins/goodscompare/components/goods-compare/goods-compare"
|
||||
},
|
||||
"componentPlaceholder": {
|
||||
"component-binding-detail-list": "view",
|
||||
|
|
@ -130,7 +131,8 @@
|
|||
"component-shop-list": "view",
|
||||
"component-ask-comments-goods": "view",
|
||||
"component-goods-comments": "view",
|
||||
"component-coupon-card": "view"
|
||||
"component-coupon-card": "view",
|
||||
"component-goods-compare": "view"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1876,6 +1878,18 @@
|
|||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"root": "pages/plugins/goodscompare",
|
||||
"pages": [
|
||||
{
|
||||
"path": "index/index",
|
||||
"style": {
|
||||
"enablePullDownRefresh": true,
|
||||
"navigationBarTitleText": ""
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"preloadRule": {
|
||||
|
|
|
|||
|
|
@ -45,6 +45,13 @@
|
|||
const app = getApp();
|
||||
var common_static_url = app.globalData.get_static_url('common');
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
theme_view: app.globalData.get_theme_value_view(),
|
||||
common_static_url: common_static_url,
|
||||
};
|
||||
},
|
||||
|
||||
props: {
|
||||
propData: {
|
||||
type: [Array,String],
|
||||
|
|
@ -61,12 +68,6 @@
|
|||
default: '',
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
theme_view: app.globalData.get_theme_value_view(),
|
||||
common_static_url: common_static_url,
|
||||
};
|
||||
},
|
||||
|
||||
created: function () {},
|
||||
|
||||
|
|
|
|||
|
|
@ -564,8 +564,8 @@
|
|||
<!-- 商品服务弹层 -->
|
||||
<component-popup :propShow="popup_goodsservice_status" propPosition="bottom" @onclose="popup_goodsservice_close_event">
|
||||
<view class="padding-horizontal-main padding-top-main bg-white">
|
||||
<view class="close oh">
|
||||
<view class="fr" @tap.stop="popup_goodsservice_close_event">
|
||||
<view class="close oh pa top-0 right-0 z-i-deep">
|
||||
<view class="fr padding-top padding-right padding-left-sm padding-bottom-sm" @tap.stop="popup_goodsservice_close_event">
|
||||
<iconfont name="icon-close-o" size="28rpx" color="#999"></iconfont>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -616,7 +616,10 @@
|
|||
<block v-if="(plugins_categorylimit_data || null) != null">
|
||||
<component-categorylimit-warm-tips :propData="plugins_categorylimit_data"></component-categorylimit-warm-tips>
|
||||
</block>
|
||||
|
||||
|
||||
<!-- 商品对比 -->
|
||||
<component-goods-compare :propGoods="goods"></component-goods-compare>
|
||||
|
||||
<!-- 公共 -->
|
||||
<component-common ref="common"></component-common>
|
||||
</view>
|
||||
|
|
@ -643,7 +646,8 @@
|
|||
import componentRealstoreCart from '@/components/realstore-cart/realstore-cart';
|
||||
import componentGoodsList from '@/components/goods-list/goods-list';
|
||||
import componentWholesaleRules from '@/components/wholesale-rules/wholesale-rules';
|
||||
import componentCategorylimitWarmTips from '@/components/categorylimit-warm-tips/categorylimit-warm-tips';
|
||||
import componentCategorylimitWarmTips from '@/pages/goods-detail/components/categorylimit-warm-tips/categorylimit-warm-tips';
|
||||
import componentGoodsCompare from '@/pages/plugins/goodscompare/components/goods-compare/goods-compare';
|
||||
|
||||
var common_static_url = app.globalData.get_static_url('common');
|
||||
var system_info = app.globalData.get_system_info() || {};
|
||||
|
|
@ -800,7 +804,8 @@
|
|||
componentRealstoreCart,
|
||||
componentGoodsList,
|
||||
componentWholesaleRules,
|
||||
componentCategorylimitWarmTips
|
||||
componentCategorylimitWarmTips,
|
||||
componentGoodsCompare
|
||||
},
|
||||
|
||||
onLoad(params) {
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@
|
|||
<text class="fr cr-grey">{{ item.goods.inventory }}{{ item.goods.inventory_unit }}</text>
|
||||
</view>
|
||||
<view v-if="(item.spec_text_view || null) != null" class="cr-grey margin-top-xs text-size-xs">{{ item.spec_text_view }}</view>
|
||||
<text class="br-red cr-red text-size-xs padding-horizontal-main padding-top-xs padding-bottom-xs round pa cp operate-submit" :data-index="index" @tap="goods_remove_event">{{$t('recommend-form.recommend-form.q536vp')}}</text>
|
||||
<text class="br-red cr-red text-size-xs padding-horizontal-main padding-top-xs padding-bottom-xs round pa cp operate-submit" :data-index="index" @tap="goods_remove_event">{{$t('common.remove')}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,211 @@
|
|||
<template>
|
||||
<view :class="theme_view">
|
||||
<block v-if="(config || null) != null && (config.is_compare_run_app || 0) == 1 && (config.compare_run_icon_app || null) != null">
|
||||
<image class="compare-run-icon pf right-xxxxxl" :src="config.compare_run_icon_app" mode="aspectFit" @tap="compare_run_event"></image>
|
||||
</block>
|
||||
|
||||
<!-- 弹窗 -->
|
||||
<component-popup :propShow="popup_status" propPosition="bottom" @onclose="popup_close_event">
|
||||
<view class="popup-container padding-top-xxxl">
|
||||
<view class="close oh pa top-0 right-0 z-i-deep">
|
||||
<view class="fr padding-top padding-right padding-left-sm padding-bottom-sm" @tap.stop="popup_close_event">
|
||||
<iconfont name="icon-close-o" size="28rpx" color="#999"></iconfont>
|
||||
</view>
|
||||
</view>
|
||||
<view class="margin-top-xl">
|
||||
<block v-if="data_list.length > 0">
|
||||
<view class="data-list">
|
||||
<block v-for="(item, index) in data_list" :key="index">
|
||||
<view class="goods-item flex-row align-c bs-bb padding-main pr wh-auto cp">
|
||||
<view @tap="selected_event" :data-index="index" class="cart-selected pr z-i">
|
||||
<iconfont :name="'icon-zhifu-' + (item.selected || false ? 'yixuan' : 'weixuan')" size="40rpx" :color="item.selected || false ? theme_color : '#999'"></iconfont>
|
||||
</view>
|
||||
<view class="item oh padding-left-main flex-1 flex-row">
|
||||
<image class="goods-image fl radius br" :src="item.images" :data-value="item.goods_url" @tap="url_event" mode="aspectFill"></image>
|
||||
<view class="goods-base padding-left-sm flex-1 pr">
|
||||
<view :data-value="item.goods_url" @tap="url_event" class="cp">
|
||||
<view class="cart-goods-title multi-text margin-bottom-sm fw-b">{{ item.title }}</view>
|
||||
</view>
|
||||
<view class="sales-price">{{item.symbol}}{{item.price}}</view>
|
||||
<view class="cr-red text-size-xs pa right-0 bottom-0" :data-index="index" @tap="remove_event">{{$t('common.remove')}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
<view class="padding-main">
|
||||
<view class="bottom-line-exclude oh">
|
||||
<button class="bg-main br-main cr-white text-size-sm round" type="default" @tap="compare_confirm_event" hover-class="none">去对比</button>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
<block v-else>
|
||||
<component-no-data :propStatus="0"></component-no-data>
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
</component-popup>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
const app = getApp();
|
||||
import componentPopup from '@/components/popup/popup';
|
||||
import componentNoData from '@/components/no-data/no-data';
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
theme_view: app.globalData.get_theme_value_view(),
|
||||
theme_color: app.globalData.get_theme_color(),
|
||||
cache_key: 'cache-plugins-goodscompare-pk-goods-data',
|
||||
popup_status: false,
|
||||
data_list: [],
|
||||
goods: null,
|
||||
config: null,
|
||||
};
|
||||
},
|
||||
components: {
|
||||
componentPopup,
|
||||
componentNoData,
|
||||
},
|
||||
// 属性
|
||||
props: {
|
||||
propGoods: {
|
||||
type: [Array,Object,String],
|
||||
default: '',
|
||||
},
|
||||
},
|
||||
// 页面被展示
|
||||
created: function () {
|
||||
this.init_config();
|
||||
this.setData({
|
||||
goods: this.propGoods,
|
||||
});
|
||||
},
|
||||
// 属性值改变监听
|
||||
watch: {
|
||||
// 是否灰度
|
||||
propGoods(value, old_value) {
|
||||
this.setData({
|
||||
goods: value,
|
||||
});
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
// 初始化配置
|
||||
init_config(status) {
|
||||
if ((status || false) == true) {
|
||||
this.setData({
|
||||
config: app.globalData.get_config('plugins_base.goodscompare.data'),
|
||||
});
|
||||
} else {
|
||||
app.globalData.is_config(this, 'init_config');
|
||||
}
|
||||
},
|
||||
|
||||
// 对比事件
|
||||
compare_run_event(e) {
|
||||
// 获取缓存
|
||||
var data = uni.getStorageSync(this.cache_key) || [];
|
||||
var item = {
|
||||
goods_id: this.goods.id,
|
||||
goods_url: this.goods.goods_url,
|
||||
price: this.goods.price,
|
||||
symbol: this.goods.show_price_symbol,
|
||||
images: this.goods.images,
|
||||
title: this.goods.title,
|
||||
selected: true
|
||||
};
|
||||
// 加入或移除
|
||||
var index = false;
|
||||
for(var i in data) {
|
||||
if(data[i]['goods_id'] == item.goods_id) {
|
||||
index = i;
|
||||
}
|
||||
}
|
||||
if(index === false) {
|
||||
data.push(item);
|
||||
} else {
|
||||
data.splice(index, 1);
|
||||
}
|
||||
this.setData({
|
||||
data_list: data
|
||||
});
|
||||
// 记录缓存
|
||||
uni.setStorageSync(this.cache_key, data);
|
||||
// 还有数据则显示弹窗
|
||||
if(data.length > 0) {
|
||||
this.setData({
|
||||
popup_status: true
|
||||
});
|
||||
}
|
||||
app.globalData.showToast(index === false ? this.$t('common.join_success') : this.$t('common.remove_success'), 'success');
|
||||
},
|
||||
|
||||
// 弹层关闭
|
||||
popup_close_event(e) {
|
||||
this.setData({
|
||||
popup_status: false,
|
||||
});
|
||||
},
|
||||
|
||||
// 选中处理
|
||||
selected_event(e) {
|
||||
var temp_data = this.data_list;
|
||||
var index = e.currentTarget.dataset.index || 0;
|
||||
temp_data[index]['selected'] = temp_data[index]['selected'] == true ? false : true;
|
||||
this.setData({
|
||||
data_list: temp_data
|
||||
});
|
||||
uni.setStorageSync(this.cache_key, temp_data);
|
||||
},
|
||||
|
||||
// 移除
|
||||
remove_event(e) {
|
||||
var temp_data = this.data_list;
|
||||
var index = e.currentTarget.dataset.index || 0;
|
||||
temp_data.splice(index, 1);
|
||||
this.setData({
|
||||
data_list: temp_data
|
||||
});
|
||||
uni.setStorageSync(this.cache_key, temp_data);
|
||||
app.globalData.showToast(this.$t('common.remove_success'), 'success');
|
||||
},
|
||||
|
||||
// url事件
|
||||
url_event(e) {
|
||||
app.globalData.url_event(e);
|
||||
},
|
||||
|
||||
// 对比确认
|
||||
compare_confirm_event(e) {
|
||||
var user = app.globalData.get_user_info(this, 'compare_confirm_event', e);
|
||||
if (user != false) {
|
||||
var goods_ids = this.data_list.map(function(v){return v.goods_id;}).join('|');
|
||||
app.globalData.url_open('/pages/plugins/goodscompare/index/index?gid='+goods_ids);
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style scoped>
|
||||
.compare-run-icon {
|
||||
width: 90rpx;
|
||||
height: 90rpx;
|
||||
bottom: 15%;
|
||||
}
|
||||
.data-list {
|
||||
max-height: 80vh;
|
||||
overflow-y: scroll;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
.data-list .goods-image {
|
||||
width: 126rpx;
|
||||
height: 126rpx;
|
||||
}
|
||||
.data-list .goods-base {
|
||||
width: calc(100% - 170rpx);
|
||||
}
|
||||
.data-list .goods-item .selected {
|
||||
margin-top: 60rpx;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
<template>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
Loading…
Reference in New Issue