门店类型选择优化
parent
eda4134496
commit
44ff0ba7ae
|
|
@ -26,7 +26,7 @@
|
|||
</view>
|
||||
</view>
|
||||
<view v-if="(plugins_realstore_info.buy_use_type_list || null) != null && plugins_realstore_info.buy_use_type_list.length > 0" class="pa top-0 right-0 padding-main cp" @tap="realstore_buy_type_switch_event">
|
||||
<text class="cr-base va-m">{{ plugins_realstore_info.buy_use_type_list[plugins_realstore_buy_use_type_index]['name'] }}</text>
|
||||
<text class="cr-base va-m">{{ plugins_realstore_info.buy_use_type_list[plugins_realstore_buy_use_type_active_index]['name'] }}</text>
|
||||
<view class="dis-inline-block va-m margin-left-xs">
|
||||
<iconfont name="icon-arrow-right" size="24rpx" propClass="lh-il" color="#666"></iconfont>
|
||||
</view>
|
||||
|
|
@ -393,7 +393,7 @@
|
|||
// 门店插件数据
|
||||
plugins_realstore_data: null,
|
||||
plugins_realstore_info: null,
|
||||
plugins_realstore_buy_use_type_index: 0,
|
||||
plugins_realstore_buy_use_type_active_index: 0,
|
||||
plugins_realstore_choice_status: false,
|
||||
// 智能工具箱插件
|
||||
plugins_intellectstools_data: null,
|
||||
|
|
@ -537,9 +537,10 @@
|
|||
if (this.cart_type_value == 'realstore' && (this.plugins_realstore_info || null) != null) {
|
||||
// 门店购物车初始化、避免上一个页面更改了门店下单类型
|
||||
this.realstore_cart_data_init();
|
||||
// 门店请求参数
|
||||
// 门店请求参数
|
||||
var type_data = this.$refs.realstore_cart.buy_use_type_data();
|
||||
var post_data = {
|
||||
buy_use_type_index: this.plugins_realstore_buy_use_type_index,
|
||||
buy_use_type_data_index: type_data.data_index,
|
||||
id: this.plugins_realstore_info.id,
|
||||
};
|
||||
this.get_cart_data(type, app.globalData.get_request_url('cartdata', 'detail', 'realstore'), post_data);
|
||||
|
|
@ -1053,9 +1054,10 @@
|
|||
ids: ids.join(','),
|
||||
};
|
||||
// 是否门店模式
|
||||
if (this.cart_type_value == 'realstore' && (this.plugins_realstore_info || null) != null) {
|
||||
if (this.cart_type_value == 'realstore' && (this.plugins_realstore_info || null) != null) {
|
||||
var type_data = this.$refs.realstore_cart.buy_use_type_data();
|
||||
data['buy_use_type_data_index'] = type_data.data_index;
|
||||
data['realstore_id'] = this.plugins_realstore_info.id;
|
||||
data['buy_use_type_index'] = this.plugins_realstore_buy_use_type_index;
|
||||
}
|
||||
return data;
|
||||
},
|
||||
|
|
@ -1255,9 +1257,10 @@
|
|||
if ((this.plugins_realstore_info || null) != null) {
|
||||
// 初始化门店购物车
|
||||
this.$refs.realstore_cart.init({ source: 'system-cart', info: this.plugins_realstore_info });
|
||||
// 初始当前门店下单类型
|
||||
// 初始当前门店下单类型
|
||||
var type_data = this.$refs.realstore_cart.buy_use_type_data();
|
||||
this.setData({
|
||||
plugins_realstore_buy_use_type_index: this.$refs.realstore_cart.get_buy_use_type_index(),
|
||||
plugins_realstore_buy_use_type_active_index: type_data.active_index,
|
||||
});
|
||||
}
|
||||
},
|
||||
|
|
@ -1271,7 +1274,7 @@
|
|||
realstore_buy_type_switch_back_event(params) {
|
||||
this.setData({
|
||||
data_list_loding_status: 1,
|
||||
plugins_realstore_buy_use_type_index: params.index,
|
||||
plugins_realstore_buy_use_type_active_index: params.buy_use_type_active_index,
|
||||
});
|
||||
// 重新加载数据
|
||||
this.get_data();
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
<view v-if="propIsShowAddressChoice" class="choice-location pr wh-auto oh" :style="propLocationContainerStyle" @tap.stop="choose_user_location">
|
||||
<view class="flex-row gap-2 align-c oh" :style="propLocationImgContainerStyle">
|
||||
<view v-if="propIsLeftIconArrow" class="dis-inline-block va-m lh">
|
||||
<block v-if="propLeftImgValue.length > 0">
|
||||
<block v-if="(propLeftImgValue || null) != null && propLeftImgValue.length > 0">
|
||||
<image :src="propLeftImgValue[0].url" class="dis-block" mode="heightFix"></image>
|
||||
</block>
|
||||
<block v-else>
|
||||
|
|
@ -12,7 +12,7 @@
|
|||
</view>
|
||||
<view :class="'va-m dis-inline-block margin-left-xs single-text text' + (propType == 'header' ? ' text-size-md' : ' text-size-xs')" :style="'max-width:' + propTextMaxWidth + ';color:' + (propTextColor || propBaseColor) + ';'">{{ location.text || '' }}</view>
|
||||
<view v-if="propIsRightIconArrow" class="va-m lh dis-inline-block margin-left-xs">
|
||||
<block v-if="propRightImgValue.length > 0">
|
||||
<block v-if="(propRightImgValue || null) != null && propRightImgValue.length > 0">
|
||||
<image :src="propRightImgValue[0].url" class="dis-block" mode="heightFix"></image>
|
||||
</block>
|
||||
<block v-else>
|
||||
|
|
@ -75,8 +75,8 @@
|
|||
default: true,
|
||||
},
|
||||
propLeftImgValue: {
|
||||
type: Array,
|
||||
default: [],
|
||||
type: [Array,String],
|
||||
default: '',
|
||||
},
|
||||
propLeftIconValue: {
|
||||
type: String,
|
||||
|
|
@ -87,8 +87,8 @@
|
|||
default: true,
|
||||
},
|
||||
propRightImgValue: {
|
||||
type: Array,
|
||||
default: [],
|
||||
type: [Array,String],
|
||||
default: '',
|
||||
},
|
||||
propRightIconValue: {
|
||||
type: String,
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
<view v-if="(info.buy_use_type_list || null) != null && info.buy_use_type_list.length > 0" class="dis-inline-block margin-left-xl">
|
||||
<text class="cr-red">{{$t('realstore-cart.realstore-cart.v437n6')}}</text>
|
||||
<view class="va-m dis-inline-block br-green cr-green round padding-horizontal-sm padding-vertical-xs cp" @tap="buy_use_type_event">
|
||||
<text class="va-m">{{$t('realstore-cart.realstore-cart.6bmc34')}}({{info.buy_use_type_list[buy_use_type_index]['name']}})</text>
|
||||
<text class="va-m">{{$t('realstore-cart.realstore-cart.6bmc34')}}({{info.buy_use_type_list[buy_use_type_active_index]['name']}})</text>
|
||||
<view class="va-m dis-inline-block margin-left-xs">
|
||||
<iconfont name="icon-arrow-bottom" size="24rpx" propClass="cr-green"></iconfont>
|
||||
</view>
|
||||
|
|
@ -28,7 +28,7 @@
|
|||
</view>
|
||||
<scroll-view :scroll-y="true" class="cart-list goods-list">
|
||||
<view v-for="(goods, index) in cart.data" :key="index" class="item padding-main oh spacing-mb">
|
||||
<view :data-index="index" :data-value="'/pages/goods-detail/goods-detail?id=' + goods.goods_id + '&is_opt_back=1&buy_use_type_index=' + buy_use_type_index + '&realstore_id=' + info.id" @tap="goods_event">
|
||||
<view :data-index="index" @tap="goods_event">
|
||||
<view class="flex-row jc-sb">
|
||||
<image :src="goods.images" mode="widthFix" class="goods-img radius br"></image>
|
||||
<view class="goods-base flex-1 flex-width padding-left-main flex-col jc-sb">
|
||||
|
|
@ -64,7 +64,7 @@
|
|||
<view v-if="(info.buy_use_type_list || null) != null && info.buy_use_type_list.length > 0" class="padding-vertical-xxxl margin-vertical-xxxl tc text-size-xs">
|
||||
<text class="cr-red va-m">{{$t('realstore-cart.realstore-cart.v437n6')}}</text>
|
||||
<view class="va-m dis-inline-block br-green cr-green round padding-horizontal padding-vertical-xs cp" @tap="buy_use_type_event">
|
||||
<text class="va-m">{{$t('realstore-cart.realstore-cart.6bmc34')}}{{info.buy_use_type_list[buy_use_type_index]['name']}})</text>
|
||||
<text class="va-m">{{$t('realstore-cart.realstore-cart.6bmc34')}}{{info.buy_use_type_list[buy_use_type_active_index]['name']}})</text>
|
||||
<view class="va-m dis-inline-block margin-left-xs">
|
||||
<iconfont name="icon-arrow-bottom" size="24rpx" propClass="cr-green"></iconfont>
|
||||
</view>
|
||||
|
|
@ -166,8 +166,8 @@
|
|||
// 临时操作数据
|
||||
temp_opt_data: null,
|
||||
// 下单类型
|
||||
cache_buy_use_type_index_key: 'cache_plugins_realstore_buy_use_type_index_',
|
||||
buy_use_type_index: 0,
|
||||
cache_buy_use_type_active_index_key: 'cache_plugins_realstore_buy_use_type_active_index_',
|
||||
buy_use_type_active_index: 0,
|
||||
// 下单类型选择弹窗
|
||||
buy_use_type_choice_list: [],
|
||||
buy_use_type_choice_status: false,
|
||||
|
|
@ -232,10 +232,10 @@
|
|||
});
|
||||
|
||||
// 商品来源
|
||||
var index = this.get_buy_use_type_index();
|
||||
var type_data = this.buy_use_type_data();
|
||||
if(this.source == 'goods' && (params.realstore_id || null) == null) {
|
||||
// 调用父级需要重新加载数据
|
||||
this.$emit('RefreshLoadingEvent', {buy_use_type_index: index, realstore_id: this.info.id});
|
||||
this.$emit('RefreshLoadingEvent', {buy_use_type_active_index: type_data.active_index, buy_use_type_data_index: type_data.data_index, realstore_id: this.info.id});
|
||||
} else {
|
||||
// 非系统购物车来源
|
||||
if(this.source != 'system-cart') {
|
||||
|
|
@ -284,7 +284,7 @@
|
|||
|
||||
// 是否需要弹出下单类型选择
|
||||
// 打开开关,并且店铺必须存在下单类型
|
||||
var cache_index = this.get_cache_buy_use_type_index();
|
||||
var cache_index = this.get_cache_buy_use_type_active_index();
|
||||
if((this.base || null) != null && parseInt(this.base.is_tips_user_choice_buy_use_type || 0) == 1 && (cache_index === null || cache_index === '') && (this.info.buy_use_type_list || null) != null && this.info.buy_use_type_list.length > 1 && (this.info.status_info || null) != null && this.info.status_info.status == 1) {
|
||||
// 门店、商品是否开启了弹窗提示
|
||||
var key = 'is_tips_user_choice_buy_use_type_'+this.params.source+'_detail';
|
||||
|
|
@ -311,15 +311,15 @@
|
|||
}
|
||||
}
|
||||
|
||||
// 设置下单类型
|
||||
this.setData({
|
||||
buy_use_type_index: index,
|
||||
});
|
||||
|
||||
// 获取购物车数据
|
||||
this.get_cart_data();
|
||||
}
|
||||
}
|
||||
|
||||
// 设置下单类型
|
||||
this.setData({
|
||||
buy_use_type_active_index: type_data.active_index,
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
@ -404,10 +404,9 @@
|
|||
// 是否限制类型
|
||||
var limit_type = this.info.starting_price_limit_type_list || [];
|
||||
if(limit_type.length > 0) {
|
||||
var index = this.get_buy_use_type_index();
|
||||
var buy_use_type = this.info.buy_use_type_list[index];
|
||||
if(limit_type.indexOf(buy_use_type['index']) != -1 || limit_type.indexOf(buy_use_type['index'].toString()) != -1) {
|
||||
return buy_use_type['name'] + this.$t('realstore-cart.realstore-cart.miv944')+ this.propCurrencySymbol + starting_price;
|
||||
var type_data = this.buy_use_type_data();
|
||||
if(limit_type.indexOf(type_data.data_index) != -1 || limit_type.indexOf(type_data.data_index.toString()) != -1) {
|
||||
return temp['name'] + this.$t('realstore-cart.realstore-cart.miv944')+ this.propCurrencySymbol + starting_price;
|
||||
}
|
||||
} else {
|
||||
return this.$t('realstore-cart.realstore-cart.miv944') + this.propCurrencySymbol + starting_price;
|
||||
|
|
@ -879,11 +878,11 @@
|
|||
// 下单类型确认处理
|
||||
buy_use_type_confirm_handle(self, index) {
|
||||
self.setData({
|
||||
buy_use_type_index: index,
|
||||
buy_use_type_active_index: index,
|
||||
settlement_btn_loading: true,
|
||||
realstore_goods_data_cart_loading: true,
|
||||
});
|
||||
uni.setStorageSync(self.cache_buy_use_type_index_key+self.info.id, index);
|
||||
uni.setStorageSync(self.cache_buy_use_type_active_index_key+self.info.id, index);
|
||||
|
||||
// 获取购物车数据、系统购物车来源则不执行
|
||||
if(this.source != 'system-cart') {
|
||||
|
|
@ -891,7 +890,8 @@
|
|||
}
|
||||
|
||||
// 下单类型切换回调
|
||||
self.$emit('BuyTypeSwitchEvent', {index: index, buy_use_type_index: this.get_buy_use_type_index(), realstore_id: this.info.id});
|
||||
var type_data = this.buy_use_type_data();
|
||||
self.$emit('BuyTypeSwitchEvent', {buy_use_type_active_index: type_data.active_index, buy_use_type_data_index: type_data.data_index, realstore_id: this.info.id});
|
||||
},
|
||||
|
||||
// 下单类型弹窗关闭
|
||||
|
|
@ -903,38 +903,42 @@
|
|||
},
|
||||
|
||||
// 获取使用类型数据索引、默认在店0
|
||||
get_buy_use_type_index() {
|
||||
buy_use_type_data() {
|
||||
// 不在店铺设置的类型列表则默认0
|
||||
var data = {
|
||||
active_index: 0,
|
||||
data_index: 0,
|
||||
}
|
||||
// 门店信息
|
||||
if((this.info || null) != null) {
|
||||
// 用户未设置类型则使用默认的
|
||||
var index = this.get_cache_buy_use_type_index();
|
||||
if(index === null || index === '') {
|
||||
var active_index = this.get_cache_buy_use_type_active_index();
|
||||
if(active_index !== null && active_index !== '') {
|
||||
var temp = this.info.buy_use_type_list[active_index] || null;
|
||||
if(temp != null) {
|
||||
data['active_index'] = active_index;
|
||||
data['data_index'] = temp.index;
|
||||
}
|
||||
} else {
|
||||
// 是否默认类型
|
||||
if(this.info.default_buy_use_type != undefined && this.info.default_buy_use_type != -1) {
|
||||
// 不在店铺设置的类型列表则默认0
|
||||
var temp_index = null;
|
||||
for (var i in this.info.buy_use_type_list) {
|
||||
if(this.info.buy_use_type_list[i]['index'] == this.info.default_buy_use_type) {
|
||||
temp_index = i;
|
||||
data['active_index'] = i;
|
||||
data['data_index'] = this.info.buy_use_type_list[i]['index'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(temp_index !== null) {
|
||||
index = temp_index;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 不在店铺设置的类型列表则默认0
|
||||
if(this.info.buy_use_type_list[index] == undefined) {
|
||||
index = 0;
|
||||
}
|
||||
return index;
|
||||
}
|
||||
return 0;
|
||||
return data;
|
||||
},
|
||||
|
||||
// 获取下单类型缓存数据
|
||||
get_cache_buy_use_type_index() {
|
||||
return uni.getStorageSync(this.cache_buy_use_type_index_key+this.info.id);
|
||||
get_cache_buy_use_type_active_index() {
|
||||
return uni.getStorageSync(this.cache_buy_use_type_active_index_key+this.info.id);
|
||||
},
|
||||
|
||||
// 请求参数处理
|
||||
|
|
@ -943,11 +947,8 @@
|
|||
request_params_merge(data, type = 'init') {
|
||||
// 用户使用类型
|
||||
if((this.info || null) != null && (this.info.buy_use_type_list || null) != null && this.info.buy_use_type_list.length > 0) {
|
||||
var index = this.get_buy_use_type_index();
|
||||
if(this.info.buy_use_type_list[index] == undefined) {
|
||||
index = 0;
|
||||
}
|
||||
data['buy_use_type_index'] = index;
|
||||
var type_data = this.buy_use_type_data();
|
||||
data['buy_use_type_data_index'] = type_data.data_index;
|
||||
}
|
||||
|
||||
// 初始化
|
||||
|
|
@ -994,9 +995,11 @@
|
|||
var goods = this.cart.data[e.currentTarget.dataset.index];
|
||||
goods['id'] = goods.goods_id;
|
||||
app.globalData.goods_data_cache_handle(goods.id, goods);
|
||||
|
||||
|
||||
// 调用公共打开url地址
|
||||
app.globalData.url_event(e);
|
||||
var type_data = this.buy_use_type_data();
|
||||
var url = '/pages/goods-detail/goods-detail?id=' + goods.id + '&is_opt_back=1&buy_use_type_data_index=' + type_data.data_index + '&realstore_id=' + this.info.id;
|
||||
app.globalData.url_open(url);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1137,7 +1137,7 @@
|
|||
// 是否门店模式下
|
||||
if (this.is_realstore_model) {
|
||||
// 覆盖选择的门店下单类型参数索引值
|
||||
upd_data['params'] = {...this.params, ...{buy_use_type_index: this.buy_site_model_list[index]['index']}};
|
||||
upd_data['params'] = {...this.params, ...{buy_use_type_data_index: this.buy_site_model_list[index]['index']}};
|
||||
}
|
||||
this.setData(upd_data);
|
||||
|
||||
|
|
|
|||
|
|
@ -1489,6 +1489,7 @@
|
|||
|
||||
// 下单类型切换事件、数据刷新事件
|
||||
refresh_loading_event(params) {
|
||||
console.log(params)
|
||||
this.setData({params: {...this.params, ...params}});
|
||||
this.init();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@
|
|||
<image :src="info.logo" mode="widthFix" class="logo border-radius-sm fl br" :data-value="info.logo" @tap="image_show_event"></image>
|
||||
<view class="base-right padding-left-sm flex-1 flex-width">
|
||||
<view v-if="is_base_mode != 1 && (info.buy_use_type_list || null) != null && info.buy_use_type_list.length > 0" class="use-type-icon pa text-size-xs cr-white bg-main tl" @tap="buy_use_type_event">
|
||||
<text class="va-m margin-right-xs">{{ info.buy_use_type_list[buy_use_type_index]['name'] }}</text>
|
||||
<text class="va-m margin-right-xs">{{ info.buy_use_type_list[buy_use_type_active_index]['name'] }}</text>
|
||||
<view class="dis-inline-block va-m pr">
|
||||
<iconfont name="icon-arrow-bottom" size="24rpx" color="#fff"></iconfont>
|
||||
</view>
|
||||
|
|
@ -159,7 +159,7 @@
|
|||
<block v-if="(data_list || null) != null && data_list.length > 0">
|
||||
<block v-for="(item, index) in data_list" :key="index">
|
||||
<view :class="'goods-item bg-white padding-main border-radius-main oh spacing-mb '+((item.is_highlight || 0) == 1 ? 'item-highlight' : '')">
|
||||
<view :data-index="index" :data-value="'/pages/goods-detail/goods-detail?id=' + item.id + '&is_opt_back=1&buy_use_type_index=' + buy_use_type_index + '&realstore_id=' + info.id" @tap="goods_event">
|
||||
<view :data-index="index" @tap="goods_event">
|
||||
<view class="flex-row jc-sb">
|
||||
<image :src="item.images" mode="widthFix" class="goods-img radius fl br"></image>
|
||||
<view class="goods-base flex-1 flex-width padding-left-main flex-col jc-sb">
|
||||
|
|
@ -326,7 +326,6 @@
|
|||
is_base_mode: 0,
|
||||
is_base_mode_show_type: 0,
|
||||
is_cart_nav: false,
|
||||
buy_use_type_index: 0,
|
||||
params: null,
|
||||
is_first: 1,
|
||||
scroll_top: 0,
|
||||
|
|
@ -352,7 +351,7 @@
|
|||
{ name: this.$t('goods-detail.goods-detail.567uhg'), value: 1 },
|
||||
],
|
||||
// 下单类型
|
||||
buy_use_type_index: 0,
|
||||
buy_use_type_active_index: 0,
|
||||
// 排序导航
|
||||
search_nav_sort_index: 0,
|
||||
search_nav_sort_list: [{
|
||||
|
|
@ -587,8 +586,9 @@
|
|||
}
|
||||
|
||||
// 下单类型索引
|
||||
var type_data = this.buy_use_type_data();
|
||||
this.setData({
|
||||
buy_use_type_index: this.get_buy_use_type_index(),
|
||||
buy_use_type_active_index: type_data.active_index,
|
||||
});
|
||||
|
||||
// 获取数据、仅首次调用,获取列表接口
|
||||
|
|
@ -809,8 +809,9 @@
|
|||
} else {
|
||||
if ((this.$refs.goods_buy || null) != null) {
|
||||
var buy_params = this.params;
|
||||
var type_data = this.buy_use_type_data();
|
||||
buy_params['buy_event_type'] = 'cart';
|
||||
buy_params['buy_use_type_index'] = this.get_buy_use_type_index();
|
||||
buy_params['buy_use_type_data_index'] = type_data.data_index;
|
||||
buy_params['realstore_id'] = this.info.id;
|
||||
this.$refs.goods_buy.init(temp_goods, buy_params);
|
||||
}
|
||||
|
|
@ -1029,7 +1030,7 @@
|
|||
// 下单类型切换事件回调
|
||||
buy_type_switch_event(params) {
|
||||
this.setData({
|
||||
buy_use_type_index: params.index,
|
||||
buy_use_type_active_index: params.buy_use_type_active_index,
|
||||
data_page: 1,
|
||||
});
|
||||
this.reset_scroll();
|
||||
|
|
@ -1037,8 +1038,8 @@
|
|||
},
|
||||
|
||||
// 获取使用类型数据索引、默认在店0
|
||||
get_buy_use_type_index() {
|
||||
return this.$refs.realstore_cart.get_buy_use_type_index();
|
||||
buy_use_type_data() {
|
||||
return this.$refs.realstore_cart.buy_use_type_data();
|
||||
},
|
||||
|
||||
// 商品事件
|
||||
|
|
@ -1050,7 +1051,9 @@
|
|||
app.globalData.goods_data_cache_handle(goods.id, goods);
|
||||
|
||||
// 调用公共打开url地址
|
||||
app.globalData.url_event(e);
|
||||
var type_data = this.buy_use_type_data();
|
||||
var url = '/pages/goods-detail/goods-detail?id=' + goods.id + '&is_opt_back=1&buy_use_type_data_index=' + type_data.data_index + '&realstore_id=' + this.info.id;
|
||||
app.globalData.url_open(url);
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue