门店类型选择优化

master
gongfuxiang 2025-01-26 15:13:31 +08:00
parent eda4134496
commit 44ff0ba7ae
6 changed files with 80 additions and 70 deletions

View File

@ -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();

View File

@ -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,

View File

@ -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);
}
}
}

View File

@ -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);

View File

@ -1489,6 +1489,7 @@
//
refresh_loading_event(params) {
console.log(params)
this.setData({params: {...this.params, ...params}});
this.init();
}

View File

@ -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);
}
},