商品搜索开发+细节优化
parent
f5fd92cfb7
commit
57ecb34cee
|
|
@ -242,17 +242,8 @@ button[disabled]..button-main {
|
|||
|
||||
/**
|
||||
* 统一颜色
|
||||
* 文本主色、次主色、搭配色、基础色、白色、绿色、黑色、灰色、浅灰色、红色
|
||||
* 文本基础色、白色、绿色、黑色、灰色、浅灰色、红色、搭配色、次主色、主色
|
||||
*/
|
||||
.cr-main {
|
||||
color: #f6c133 !important;
|
||||
}
|
||||
.cr-main-light {
|
||||
color: #ffebd2 !important;
|
||||
}
|
||||
.cr-main-pair {
|
||||
color: #795548 !important;
|
||||
}
|
||||
.cr-base {
|
||||
color: #666 !important;
|
||||
}
|
||||
|
|
@ -274,6 +265,15 @@ button[disabled]..button-main {
|
|||
.cr-red {
|
||||
color: #f00 !important;
|
||||
}
|
||||
.cr-main-pair {
|
||||
color: #795548 !important;
|
||||
}
|
||||
.cr-main-light {
|
||||
color: #ffebd2 !important;
|
||||
}
|
||||
.cr-main {
|
||||
color: #f6c133 !important;
|
||||
}
|
||||
|
||||
/**
|
||||
* 统一背景色
|
||||
|
|
@ -299,6 +299,9 @@ button[disabled]..button-main {
|
|||
}
|
||||
.bg-gray {
|
||||
background-color: #d6d6d6 !important;
|
||||
}
|
||||
.bg-base {
|
||||
background-color: #f5f5f5 !important;
|
||||
}
|
||||
button[disabled].bg-main {
|
||||
background-color: #fdd178 !important;
|
||||
|
|
|
|||
|
|
@ -34,9 +34,7 @@
|
|||
position: fixed;
|
||||
background: #fff;
|
||||
z-index: 101;
|
||||
overflow: hidden;
|
||||
border-top-right-radius: 20rpx;
|
||||
border-top-left-radius: 20rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
.popup-mask {
|
||||
position: fixed;
|
||||
|
|
@ -83,5 +81,21 @@
|
|||
}
|
||||
.popup.animation .popup-mask {
|
||||
transition: all 0.25s linear;
|
||||
}
|
||||
.popup-top {
|
||||
border-bottom-right-radius: 20rpx;
|
||||
border-bottom-left-radius: 20rpx;
|
||||
}
|
||||
.popup-bottom {
|
||||
border-top-right-radius: 20rpx;
|
||||
border-top-left-radius: 20rpx;
|
||||
}
|
||||
.popup-left {
|
||||
border-top-right-radius: 20rpx;
|
||||
border-bottom-right-radius: 20rpx;
|
||||
}
|
||||
.popup-right {
|
||||
border-top-left-radius: 20rpx;
|
||||
border-bottom-left-radius: 20rpx;
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
<text class="fr">{{address.tel}}</text>
|
||||
</view>
|
||||
<view class="address-detail oh margin-top-lg">
|
||||
<image class="icon fl" src="/static/images/user-address.png" mode="widthFix"></image>
|
||||
<image class="icon fl" :src="common_static_url+'map-icon.png'" mode="widthFix"></image>
|
||||
<view class="text fr">
|
||||
{{address.province_name || ''}}{{address.city_name || ''}}{{address.county_name || ''}}{{address.address || ''}}
|
||||
</view>
|
||||
|
|
@ -234,26 +234,24 @@
|
|||
|
||||
onLoad(params) {
|
||||
//params['data'] = '{"buy_type":"goods","goods_id":"1","stock":"1","spec":"[]"}';
|
||||
if ((params.data || null) != null && app.globalData.get_length(JSON.parse(decodeURIComponent(params
|
||||
.data))) > 0) {
|
||||
if ((params.data || null) != null && app.globalData.get_length(JSON.parse(decodeURIComponent(params.data))) > 0) {
|
||||
this.setData({
|
||||
params: JSON.parse(decodeURIComponent(params.data))
|
||||
}); // 删除地址缓存
|
||||
|
||||
});
|
||||
|
||||
// 删除地址缓存
|
||||
uni.removeStorageSync(app.globalData.data.cache_buy_user_address_select_key);
|
||||
}
|
||||
},
|
||||
|
||||
onShow() {
|
||||
uni.setNavigationBarTitle({
|
||||
title: app.globalData.data.common_pages_title.buy
|
||||
}); // 数据加载
|
||||
|
||||
onShow() {
|
||||
// 数据加载
|
||||
this.init();
|
||||
this.setData({
|
||||
is_first: 0
|
||||
}); // 初始化配置
|
||||
|
||||
});
|
||||
|
||||
// 初始化配置
|
||||
this.init_config();
|
||||
},
|
||||
|
||||
|
|
@ -285,21 +283,20 @@
|
|||
});
|
||||
uni.stopPullDownRefresh();
|
||||
return false;
|
||||
} // 本地缓存地址
|
||||
|
||||
}
|
||||
|
||||
// 本地缓存地址
|
||||
if (this.is_first == 0) {
|
||||
var cache_address = uni.getStorageSync(app.globalData.data.cache_buy_user_address_select_key);
|
||||
|
||||
if ((cache_address || null) != null) {
|
||||
this.setData({
|
||||
address: cache_address,
|
||||
address_id: cache_address.id
|
||||
});
|
||||
}
|
||||
} // 加载loding
|
||||
|
||||
}
|
||||
|
||||
// 加载loding
|
||||
uni.showLoading({
|
||||
title: '加载中...'
|
||||
});
|
||||
|
|
@ -318,7 +315,6 @@
|
|||
success: res => {
|
||||
uni.stopPullDownRefresh();
|
||||
uni.hideLoading();
|
||||
|
||||
if (res.data.code == 0) {
|
||||
var data = res.data.data;
|
||||
|
||||
|
|
@ -336,46 +332,38 @@
|
|||
extraction_address: data.base.extraction_address || [],
|
||||
plugins_coupon_data: data.plugins_coupon_data || null,
|
||||
plugins_points_data: data.plugins_points_data || null
|
||||
}); // 优惠劵选择处理
|
||||
|
||||
});
|
||||
|
||||
// 优惠劵选择处理
|
||||
if ((data.plugins_coupon_data || null) != null) {
|
||||
var plugins_choice_coupon_value = [];
|
||||
|
||||
for (var i in data.plugins_coupon_data) {
|
||||
var cupk = data.plugins_coupon_data[i]['warehouse_id'];
|
||||
|
||||
if ((data.plugins_coupon_data[i]['coupon_data']['coupon_choice'] ||
|
||||
null) != null) {
|
||||
plugins_choice_coupon_value[cupk] = data.plugins_coupon_data[i][
|
||||
'coupon_data'
|
||||
]['coupon_choice']['coupon']['desc'];
|
||||
if ((data.plugins_coupon_data[i]['coupon_data']['coupon_choice'] || null) != null) {
|
||||
plugins_choice_coupon_value[cupk] = data.plugins_coupon_data[i]['coupon_data']['coupon_choice']['coupon']['desc'];
|
||||
} else {
|
||||
var coupon_count = (data.plugins_coupon_data[i]['coupon_data'][
|
||||
'coupon_list'
|
||||
] || null) != null ? data.plugins_coupon_data[i][
|
||||
'coupon_data'
|
||||
].coupon_list.length : 0;
|
||||
plugins_choice_coupon_value[cupk] = coupon_count > 0 ? '可选优惠劵' +
|
||||
coupon_count + '张' : '暂无可用优惠劵';
|
||||
var coupon_count = (data.plugins_coupon_data[i]['coupon_data']['coupon_list'] || null) != null ? data.plugins_coupon_data[i]['coupon_data'].coupon_list.length : 0;
|
||||
plugins_choice_coupon_value[cupk] = coupon_count > 0 ? '可选优惠劵' +coupon_count + '张' : '暂无可用优惠劵';
|
||||
}
|
||||
}
|
||||
|
||||
this.setData({
|
||||
plugins_choice_coupon_value: plugins_choice_coupon_value
|
||||
});
|
||||
} // 地址
|
||||
|
||||
}
|
||||
|
||||
// 地址
|
||||
this.setData({
|
||||
address: data.base.address || null,
|
||||
address_id: (data.base.address || null) != null ? data.base
|
||||
.address.id : null
|
||||
address_id: (data.base.address || null) != null ? data.base.address.id : null
|
||||
});
|
||||
uni.setStorage({
|
||||
key: app.globalData.data.cache_buy_user_address_select_key,
|
||||
data: data.base.address || null
|
||||
}); // 支付方式
|
||||
|
||||
});
|
||||
|
||||
// 支付方式
|
||||
this.payment_list_data(data.payment_list);
|
||||
}
|
||||
} else {
|
||||
|
|
@ -383,7 +371,6 @@
|
|||
data_list_loding_status: 2,
|
||||
data_list_loding_msg: res.data.msg
|
||||
});
|
||||
|
||||
if (app.globalData.is_login_check(res.data, this, 'init')) {
|
||||
app.globalData.showToast(res.data.msg);
|
||||
}
|
||||
|
|
@ -444,10 +431,10 @@
|
|||
data['address_id'] = this.address_id;
|
||||
data['payment_id'] = this.payment_id;
|
||||
data['user_note'] = this.user_note_value;
|
||||
data['site_model'] = this.site_model; // 数据验证
|
||||
|
||||
data['site_model'] = this.site_model;
|
||||
|
||||
// 数据验证
|
||||
var validation = [];
|
||||
|
||||
if (this.common_site_type == 0 || this.common_site_type == 2 || this.common_site_type == 4) {
|
||||
validation.push({
|
||||
fields: 'address_id',
|
||||
|
|
@ -482,8 +469,7 @@
|
|||
if (res.data.code == 0) {
|
||||
if (res.data.data.order_status == 1) {
|
||||
uni.redirectTo({
|
||||
url: '/pages/user-order/user-order?is_pay=1&order_ids=' +
|
||||
res.data.data.order_ids.join(',')
|
||||
url: '/pages/user-order/user-order?is_pay=1&order_ids=' + res.data.data.order_ids.join(',')
|
||||
});
|
||||
} else {
|
||||
uni.redirectTo({
|
||||
|
|
@ -520,15 +506,10 @@
|
|||
// 支付方式数据处理
|
||||
payment_list_data(data) {
|
||||
if (this.payment_id != 0) {
|
||||
for (var i in data) {
|
||||
if (data[i]['id'] == this.payment_id) {
|
||||
data[i]['selected'] = 'cr-main br-main';
|
||||
} else {
|
||||
data[i]['selected'] = '';
|
||||
}
|
||||
for (var i in data) {
|
||||
data[i]['selected'] = (data[i]['id'] == this.payment_id) ? 'cr-main br-main' : '';
|
||||
}
|
||||
}
|
||||
|
||||
this.setData({
|
||||
payment_list: data || []
|
||||
});
|
||||
|
|
@ -623,17 +604,18 @@
|
|||
// 销售+自提 模式选择事件
|
||||
buy_header_nav_event(e) {
|
||||
var value = e.currentTarget.dataset.value || 0;
|
||||
|
||||
if (value != this.site_model) {
|
||||
// 数据设置
|
||||
this.setData({
|
||||
address: null,
|
||||
address_id: null,
|
||||
site_model: value
|
||||
}); // 删除地址缓存
|
||||
|
||||
uni.removeStorageSync(app.globalData.data.cache_buy_user_address_select_key); // 数据初始化
|
||||
|
||||
});
|
||||
|
||||
// 删除地址缓存
|
||||
uni.removeStorageSync(app.globalData.data.cache_buy_user_address_select_key);
|
||||
|
||||
// 数据初始化
|
||||
this.init();
|
||||
}
|
||||
},
|
||||
|
|
@ -642,16 +624,14 @@
|
|||
map_event(e) {
|
||||
var index = e.currentTarget.dataset.index || 0;
|
||||
var data = this.goods_list[index] || null;
|
||||
|
||||
if (data == null) {
|
||||
app.globalData.showToast("地址有误");
|
||||
return false;
|
||||
} // 打开地图
|
||||
|
||||
}
|
||||
|
||||
// 打开地图
|
||||
var name = data.alias || data.name || '';
|
||||
var address = (data.province_name || '') + (data.city_name || '') + (data.county_name || '') + (data
|
||||
.address || '');
|
||||
var address = (data.province_name || '') + (data.city_name || '') + (data.county_name || '') + (data.address || '');
|
||||
app.globalData.open_location(data.lng, data.lat, name, address);
|
||||
},
|
||||
|
||||
|
|
@ -667,10 +647,9 @@
|
|||
warehouse_group_event(e) {
|
||||
app.globalData.url_event(e);
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style>
|
||||
@import './buy.css';
|
||||
</style>
|
||||
</style>
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
.address-logo {
|
||||
width: 140rpx;
|
||||
height: 140rpx !important;
|
||||
}
|
||||
.address .item-icon {
|
||||
width: 30rpx;
|
||||
height: 35rpx !important;
|
||||
}
|
||||
.address-alias {
|
||||
padding: 2rpx 10rpx;
|
||||
}
|
||||
.address .text {
|
||||
line-height: 44rpx;
|
||||
width: calc(100% - 40rpx);
|
||||
}
|
||||
|
|
@ -1,309 +1,262 @@
|
|||
<template>
|
||||
<view>
|
||||
<view class="page">
|
||||
<view v-if="data_list.length > 0">
|
||||
<view v-for="(item, index) in data_list" :key="index" class="item bg-white spacing-mb">
|
||||
<view @tap="address_conent_event" :data-index="index" class="oh">
|
||||
<view v-if="(item.logo || null) != null" class="fl oh margin-right-lg">
|
||||
<image class="dis-block address-logo" :src="item.logo" mode="widthFix"></image>
|
||||
</view>
|
||||
<view class="oh">
|
||||
<view class="base oh">
|
||||
<text v-if="(item.alias || null) != null" class="address-alias">{{item.alias}}</text>
|
||||
<text>{{item.name}}</text>
|
||||
<text class="fr">{{item.tel}}</text>
|
||||
</view>
|
||||
<view class="address oh">
|
||||
<image class="item-icon fl" src="/static/images/user-address.png" mode="widthFix"></image>
|
||||
<view class="text fr">{{item.province_name || ''}}{{item.city_name || ''}}{{item.county_name || ''}}{{item.address || ''}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="operation br-t oh">
|
||||
<view v-if="(item.distance_value || null) != null && (item.distance_unit || null) != null" class="fl margin-top-lg">
|
||||
<text class="cr-gray">距离</text>
|
||||
<text class="cr-base">{{item.distance_value}}</text>
|
||||
<text class="cr-gray">{{item.distance_unit}}</text>
|
||||
</view>
|
||||
<button v-if="(item.lng || null) != null && (item.lat || null) != null && item.lng != 0 && item.lat != 0" class="fr cr-base map-submit br" type="default" size="mini" @tap="address_map_event" :data-index="index" hover-class="none">查看地图</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<template>
|
||||
<view>
|
||||
<view class="page">
|
||||
<view v-if="data_list.length > 0" class="padding-main">
|
||||
<view v-for="(item, index) in data_list" :key="index" class="item bg-white padding-main border-radius-main spacing-mb">
|
||||
<view @tap="address_conent_event" :data-index="index" class="oh">
|
||||
<view v-if="(item.logo || null) != null" class="fl oh margin-right-lg">
|
||||
<image class="dis-block address-logo radius" :src="item.logo" mode="widthFix"></image>
|
||||
</view>
|
||||
<view class="oh">
|
||||
<view class="base oh padding-vertical-main">
|
||||
<text v-if="(item.alias || null) != null" class="address-alias br-main cr-main round margin-right-sm">{{item.alias}}</text>
|
||||
<text>{{item.name}}</text>
|
||||
<text class="fr">{{item.tel}}</text>
|
||||
</view>
|
||||
<view class="address oh padding-vertical-main">
|
||||
<image class="item-icon fl" :src="common_static_url+'map-icon.png'" mode="widthFix"></image>
|
||||
<view class="text fr">
|
||||
{{item.province_name || ''}}{{item.city_name || ''}}{{item.county_name || ''}}{{item.address || ''}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="((item.distance_value || null) != null && (item.distance_unit || null) != null) || ((item.lng || 0) != 0 && (item.lat || 0) != 0)" class="operation br-t oh padding-vertical-main">
|
||||
<view v-if="(item.distance_value || null) != null && (item.distance_unit || null) != null" class="fl margin-top-lg">
|
||||
<text class="cr-gray">距离</text>
|
||||
<text class="cr-base">{{item.distance_value}}</text>
|
||||
<text class="cr-gray">{{item.distance_unit}}</text>
|
||||
</view>
|
||||
<button v-if="(item.lng || 0) != 0 && (item.lat || 0) != 0" class="fr cr-base br margin-left-lg" type="default" size="mini" @tap="address_map_event" :data-index="index" hover-class="none">查看地图</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-else>
|
||||
<!-- 提示信息 -->
|
||||
<component-no-data :prop-status="data_list_loding_status"></component-no-data>
|
||||
</view>
|
||||
|
||||
<!-- 结尾 -->
|
||||
<component-bottom-line :prop-status="data_bottom_line_status"></component-bottom-line>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
const app = getApp();
|
||||
import componentNoData from "../../components/no-data/no-data";
|
||||
import componentBottomLine from "../../components/bottom-line/bottom-line";
|
||||
|
||||
<view v-if="data_list.length == 0">
|
||||
<!--<import src="/pages/common/nodata.wxml"></import>-->
|
||||
<block data-type="template" data-is="nodata" data-attr="status: data_list_loding_status">
|
||||
<!-- 1 加载中 -->
|
||||
<view v-if="0 == 1" class="no-data-loding tc">
|
||||
<text>加载中...</text>
|
||||
</view>
|
||||
var common_static_url = app.globalData.get_static_url('common');
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
common_static_url: common_static_url,
|
||||
data_list_loding_status: 1,
|
||||
data_bottom_line_status: false,
|
||||
data_list: [],
|
||||
params: null,
|
||||
is_default: 0,
|
||||
user_location_cache_key: app.globalData.data.cache_userlocation_key,
|
||||
user_location: null,
|
||||
is_first: 1,
|
||||
home_extraction_address_position: 0
|
||||
};
|
||||
},
|
||||
|
||||
components: {
|
||||
componentNoData,
|
||||
componentBottomLine
|
||||
},
|
||||
props: {},
|
||||
|
||||
onLoad(params) {
|
||||
this.setData({
|
||||
params: params,
|
||||
home_extraction_address_position: app.globalData.get_config('config.home_extraction_address_position', 0)
|
||||
});
|
||||
},
|
||||
|
||||
onReady: function() {
|
||||
// 清除位置缓存信息
|
||||
uni.removeStorage({
|
||||
key: this.user_location_cache_key
|
||||
});
|
||||
|
||||
<!-- 2 处理错误 -->
|
||||
<view v-else-if="0 == 2" class="no-data-box tc">
|
||||
<image src="/static/images/error.png" mode="widthFix"></image>
|
||||
<view class="no-data-tips">{{msg || '处理错误'}}</view>
|
||||
</view>
|
||||
// 是否获取位置
|
||||
if ((this.params.is_buy || 0) == 1 && this.home_extraction_address_position == 1) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/common/open-setting-location/open-setting-location'
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
onShow() {
|
||||
uni.setNavigationBarTitle({
|
||||
title: app.globalData.data.common_pages_title.extraction_address
|
||||
});
|
||||
|
||||
<!-- 0 默认没有数据 -->
|
||||
<view v-else-if="0 == 0" class="no-data-box tc">
|
||||
<image src="/static/images/empty.png" mode="widthFix"></image>
|
||||
<view class="no-data-tips">{{msg || '没有相关数据'}}</view>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
|
||||
<!--<import src="/pages/common/bottom_line.wxml"></import>-->
|
||||
<block data-type="template" data-is="bottom_line" data-attr="status: data_bottom_line_status">
|
||||
<view v-if="(status || false)" class="data-bottom-line">
|
||||
<view class="left fl"></view>
|
||||
<view class="msg fl">我是有底线的</view>
|
||||
<view class="right fr"></view>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
// 是否需要选择地理位置
|
||||
if (this.home_extraction_address_position == 1) {
|
||||
// 首次不请求数据
|
||||
if (this.is_first == 0) {
|
||||
this.user_location_init();
|
||||
this.init();
|
||||
}
|
||||
} else {
|
||||
this.init();
|
||||
}
|
||||
|
||||
this.setData({
|
||||
is_first: 0
|
||||
});
|
||||
},
|
||||
|
||||
// 下拉刷新
|
||||
onPullDownRefresh() {
|
||||
this.get_data_list();
|
||||
},
|
||||
|
||||
methods: {
|
||||
// 初始化
|
||||
init() {
|
||||
var user = app.globalData.get_user_info(this, "init");
|
||||
if (user != false) {
|
||||
// 用户未绑定用户则转到登录页面
|
||||
if (app.globalData.user_is_need_login(user)) {
|
||||
uni.redirectTo({
|
||||
url: "/pages/login/login?event_callback=init"
|
||||
});
|
||||
return false;
|
||||
} else {
|
||||
// 获取数据
|
||||
this.get_data_list();
|
||||
}
|
||||
} else {
|
||||
this.setData({
|
||||
data_list_loding_status: 0,
|
||||
data_bottom_line_status: false
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
// 地址信息初始化
|
||||
user_location_init() {
|
||||
var result = uni.getStorageSync(this.user_location_cache_key) || null;
|
||||
var data = null;
|
||||
if (result != null) {
|
||||
data = {
|
||||
name: result.name || null,
|
||||
address: result.address || null,
|
||||
lat: result.latitude || null,
|
||||
lng: result.longitude || null
|
||||
};
|
||||
}
|
||||
this.setData({
|
||||
user_location: data
|
||||
});
|
||||
},
|
||||
|
||||
// 获取数据列表
|
||||
get_data_list() {
|
||||
// 加载loding
|
||||
uni.showLoading({
|
||||
title: "加载中..."
|
||||
});
|
||||
this.setData({
|
||||
data_list_loding_status: 1
|
||||
});
|
||||
|
||||
<script>
|
||||
const app = getApp();
|
||||
// 获取数据
|
||||
var data = {};
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
data_list_loding_status: 1,
|
||||
data_bottom_line_status: false,
|
||||
data_list: [],
|
||||
params: null,
|
||||
is_default: 0,
|
||||
user_location_cache_key: app.globalData.data.cache_userlocation_key,
|
||||
user_location: null,
|
||||
is_first: 1,
|
||||
home_extraction_address_position: 0
|
||||
};
|
||||
},
|
||||
|
||||
components: {},
|
||||
props: {},
|
||||
|
||||
onLoad(params) {
|
||||
this.setData({
|
||||
params: params,
|
||||
home_extraction_address_position: app.globalData.get_config('config.home_extraction_address_position', 0)
|
||||
});
|
||||
},
|
||||
|
||||
onReady: function () {
|
||||
// 清除位置缓存信息
|
||||
uni.removeStorage({
|
||||
key: this.user_location_cache_key
|
||||
}); // 是否获取位置
|
||||
|
||||
if ((this.params.is_buy || 0) == 1 && this.home_extraction_address_position == 1) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/common/open-setting-location/open-setting-location'
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
onShow() {
|
||||
uni.setNavigationBarTitle({
|
||||
title: app.globalData.data.common_pages_title.extraction_address
|
||||
}); // 是否需要选择地理位置
|
||||
|
||||
if (this.home_extraction_address_position == 1) {
|
||||
// 首次不请求数据
|
||||
if (this.is_first == 0) {
|
||||
this.user_location_init();
|
||||
this.init();
|
||||
}
|
||||
} else {
|
||||
this.init();
|
||||
}
|
||||
|
||||
this.setData({
|
||||
is_first: 0
|
||||
});
|
||||
},
|
||||
|
||||
// 下拉刷新
|
||||
onPullDownRefresh() {
|
||||
this.get_data_list();
|
||||
},
|
||||
|
||||
methods: {
|
||||
// 初始化
|
||||
init() {
|
||||
var user = app.globalData.get_user_info(this, "init");
|
||||
|
||||
if (user != false) {
|
||||
// 用户未绑定用户则转到登录页面
|
||||
if (app.globalData.user_is_need_login(user)) {
|
||||
uni.redirectTo({
|
||||
url: "/pages/login/login?event_callback=init"
|
||||
});
|
||||
return false;
|
||||
} else {
|
||||
// 获取数据
|
||||
this.get_data_list();
|
||||
}
|
||||
} else {
|
||||
this.setData({
|
||||
data_list_loding_status: 0,
|
||||
data_bottom_line_status: false
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
// 地址信息初始化
|
||||
user_location_init() {
|
||||
var result = uni.getStorageSync(this.user_location_cache_key) || null;
|
||||
var data = null;
|
||||
|
||||
if (result != null) {
|
||||
data = {
|
||||
name: result.name || null,
|
||||
address: result.address || null,
|
||||
lat: result.latitude || null,
|
||||
lng: result.longitude || null
|
||||
};
|
||||
}
|
||||
|
||||
this.setData({
|
||||
user_location: data
|
||||
});
|
||||
},
|
||||
|
||||
// 获取数据列表
|
||||
get_data_list() {
|
||||
// 加载loding
|
||||
uni.showLoading({
|
||||
title: "加载中..."
|
||||
});
|
||||
this.setData({
|
||||
data_list_loding_status: 1
|
||||
}); // 获取数据
|
||||
|
||||
var data = {}; // 是否有坐标
|
||||
|
||||
if ((this.user_location || null) != null) {
|
||||
data['lng'] = this.user_location.lng;
|
||||
data['lat'] = this.user_location.lat;
|
||||
} // 请求接口
|
||||
|
||||
|
||||
uni.request({
|
||||
url: app.globalData.get_request_url("extraction", "useraddress"),
|
||||
method: "POST",
|
||||
data: data,
|
||||
dataType: "json",
|
||||
success: res => {
|
||||
uni.hideLoading();
|
||||
uni.stopPullDownRefresh();
|
||||
|
||||
if (res.data.code == 0) {
|
||||
if (res.data.data.length > 0) {
|
||||
// 获取当前默认地址
|
||||
var is_default = 0;
|
||||
|
||||
for (var i in res.data.data) {
|
||||
if (res.data.data[i]['is_default'] == 1) {
|
||||
is_default = res.data.data[i]['id'];
|
||||
}
|
||||
} // 设置数据
|
||||
|
||||
|
||||
this.setData({
|
||||
data_list: res.data.data,
|
||||
is_default: is_default,
|
||||
data_list_loding_status: 3,
|
||||
data_bottom_line_status: true
|
||||
});
|
||||
} else {
|
||||
this.setData({
|
||||
data_list_loding_status: 0
|
||||
});
|
||||
}
|
||||
} else {
|
||||
this.setData({
|
||||
data_list_loding_status: 0
|
||||
});
|
||||
|
||||
if (app.globalData.is_login_check(res.data, this, 'get_data_list')) {
|
||||
app.globalData.showToast(res.data.msg);
|
||||
}
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
uni.hideLoading();
|
||||
uni.stopPullDownRefresh();
|
||||
this.setData({
|
||||
data_list_loding_status: 2
|
||||
});
|
||||
app.globalData.showToast("服务器请求出错");
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 地图查看
|
||||
address_map_event(e) {
|
||||
var index = e.currentTarget.dataset.index || 0;
|
||||
var data = this.data_list[index] || null;
|
||||
|
||||
if (data == null) {
|
||||
app.globalData.showToast("地址有误");
|
||||
return false;
|
||||
} // 打开地图
|
||||
|
||||
|
||||
var name = data.alias || data.name || '';
|
||||
var address = (data.province_name || '') + (data.city_name || '') + (data.county_name || '') + (data.address || '');
|
||||
app.globalData.open_location(data.lng, data.lat, name, address);
|
||||
},
|
||||
|
||||
// 地址内容事件
|
||||
address_conent_event(e) {
|
||||
var index = e.currentTarget.dataset.index || 0;
|
||||
var is_back = this.params.is_back || 0;
|
||||
|
||||
if (is_back == 1) {
|
||||
uni.setStorage({
|
||||
key: app.globalData.data.cache_buy_user_address_select_key,
|
||||
data: this.data_list[index]
|
||||
});
|
||||
uni.navigateBack();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style>
|
||||
.item {
|
||||
padding: 10rpx 10rpx 0 10rpx;
|
||||
}
|
||||
.address-logo {
|
||||
width: 140rpx;
|
||||
height: 140rpx !important;
|
||||
}
|
||||
.base, .address, .operation {
|
||||
padding: 20rpx 0;
|
||||
}
|
||||
.address .item-icon {
|
||||
width: 30rpx;
|
||||
height: 35rpx !important;
|
||||
}
|
||||
.address-alias {
|
||||
border: 1px solid #d2364c;
|
||||
color: #d2364c;
|
||||
padding: 2rpx 10rpx;
|
||||
border-radius: 6rpx;
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
.address .text {
|
||||
line-height: 44rpx;
|
||||
width: calc(100% - 40rpx);
|
||||
}
|
||||
.operation .map-submit {
|
||||
margin-left: 20rpx;
|
||||
}
|
||||
// 是否有坐标
|
||||
if ((this.user_location || null) != null) {
|
||||
data['lng'] = this.user_location.lng;
|
||||
data['lat'] = this.user_location.lat;
|
||||
}
|
||||
|
||||
// 请求接口
|
||||
uni.request({
|
||||
url: app.globalData.get_request_url("extraction", "useraddress"),
|
||||
method: "POST",
|
||||
data: data,
|
||||
dataType: "json",
|
||||
success: res => {
|
||||
uni.hideLoading();
|
||||
uni.stopPullDownRefresh();
|
||||
if (res.data.code == 0) {
|
||||
if (res.data.data.length > 0) {
|
||||
// 获取当前默认地址
|
||||
var is_default = 0;
|
||||
for (var i in res.data.data) {
|
||||
if (res.data.data[i]['is_default'] == 1) {
|
||||
is_default = res.data.data[i]['id'];
|
||||
}
|
||||
}
|
||||
|
||||
// 设置数据
|
||||
this.setData({
|
||||
data_list: res.data.data,
|
||||
is_default: is_default,
|
||||
data_list_loding_status: 3,
|
||||
data_bottom_line_status: true
|
||||
});
|
||||
} else {
|
||||
this.setData({
|
||||
data_list_loding_status: 0
|
||||
});
|
||||
}
|
||||
} else {
|
||||
this.setData({
|
||||
data_list_loding_status: 0
|
||||
});
|
||||
if (app.globalData.is_login_check(res.data, this, 'get_data_list')) {
|
||||
app.globalData.showToast(res.data.msg);
|
||||
}
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
uni.hideLoading();
|
||||
uni.stopPullDownRefresh();
|
||||
this.setData({
|
||||
data_list_loding_status: 2
|
||||
});
|
||||
app.globalData.showToast("服务器请求出错");
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 地图查看
|
||||
address_map_event(e) {
|
||||
var index = e.currentTarget.dataset.index || 0;
|
||||
var data = this.data_list[index] || null;
|
||||
if (data == null) {
|
||||
app.globalData.showToast("地址有误");
|
||||
return false;
|
||||
}
|
||||
|
||||
// 打开地图
|
||||
var name = data.alias || data.name || '';
|
||||
var address = (data.province_name || '') + (data.city_name || '') + (data.county_name || '') + (data.address || '');
|
||||
app.globalData.open_location(data.lng, data.lat, name, address);
|
||||
},
|
||||
|
||||
// 地址内容事件
|
||||
address_conent_event(e) {
|
||||
var index = e.currentTarget.dataset.index || 0;
|
||||
var is_back = this.params.is_back || 0;
|
||||
if (is_back == 1) {
|
||||
uni.setStorage({
|
||||
key: app.globalData.data.cache_buy_user_address_select_key,
|
||||
data: this.data_list[index]
|
||||
});
|
||||
uni.navigateBack();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style>
|
||||
@import './extraction-address.css';
|
||||
</style>
|
||||
|
|
@ -22,8 +22,7 @@
|
|||
<swiper :indicator-dots="indicator_dots" :indicator-color="indicator_color" :indicator-active-color="indicator_active_color" :autoplay="autoplay" :circular="circular" class="goods-photo bg-white" v-if="goods_photo.length > 0" :style="'height: ' + photo_height + ' !important;'">
|
||||
<block v-for="(item, index) in goods_photo" :key="index">
|
||||
<swiper-item>
|
||||
<image class="swiper-item wh-auto" @tap="goods_photo_view_event" :data-index="index" :src="item.images" mode="scaleToFill" :style="'height: ' + photo_height + ' !important;'">
|
||||
</image>
|
||||
<image class="swiper-item wh-auto" @tap="goods_photo_view_event" :data-index="index" :src="item.images" mode="scaleToFill" :style="'height: ' + photo_height + ' !important;'"></image>
|
||||
</swiper-item>
|
||||
</block>
|
||||
</swiper>
|
||||
|
|
@ -148,8 +147,7 @@
|
|||
<text v-if="plugins_shop_data.auth_type == 1" class="plugins-shop-auth-icon">{{plugins_shop_data.auth_type_name}}</text>
|
||||
<text>{{plugins_shop_data.name}}</text>
|
||||
</view>
|
||||
<view class="plugins-shop-desc multi-text cr-gray margin-top-sm">{{plugins_shop_data.describe}}
|
||||
</view>
|
||||
<view class="plugins-shop-desc multi-text cr-gray margin-top-sm">{{plugins_shop_data.describe}}</view>
|
||||
</view>
|
||||
</navigator>
|
||||
</view>
|
||||
|
|
@ -270,17 +268,17 @@
|
|||
</view>
|
||||
</view>
|
||||
<view :class="'btn-items fr goods-buy-nav-btn-number-' + buy_button.count || 0">
|
||||
<block v-if="(buy_button.data || null) != null && buy_button.data.length > 0">
|
||||
<block v-for="(item, index) in buy_button.data" :key="index">
|
||||
<block v-if="(item.name || null) != null && (item.type || null) != null">
|
||||
<button :class="'item fl cr-white round bg-' + ((item.color || 'main') == 'main' ? 'main' : 'main-pair')" type="default" @tap="nav_buy_submit_event" :data-type="item.type" :data-value="item.value || ''" hover-class="none">{{item.name}}</button>
|
||||
</block>
|
||||
<block v-if="(buy_button.data || null) != null && buy_button.data.length > 0">
|
||||
<block v-for="(item, index) in buy_button.data" :key="index">
|
||||
<block v-if="(item.name || null) != null && (item.type || null) != null">
|
||||
<button :class="'item fl cr-white round bg-' + ((item.color || 'main') == 'main' ? 'main' : 'main-pair')" type="default" @tap="nav_buy_submit_event" :data-type="item.type" :data-value="item.value || ''" hover-class="none">{{item.name}}</button>
|
||||
</block>
|
||||
</block>
|
||||
<block v-else>
|
||||
<button class="item bg-gray round tc" type="default" disabled>{{buy_button.error || '暂停销售'}}</button>
|
||||
</block>
|
||||
</view>
|
||||
</block>
|
||||
<block v-else>
|
||||
<button class="item bg-gray round tc" type="default" disabled>{{buy_button.error || '暂停销售'}}</button>
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 购买弹层 -->
|
||||
|
|
@ -385,10 +383,8 @@
|
|||
<text class="price">{{item.discount_value}}</text>
|
||||
<text class="unit">{{item.type_unit}}</text>
|
||||
</view>
|
||||
<view v-if="(item.use_limit_type_name || null) != null"
|
||||
class="base-tips cr-base single-text">{{item.use_limit_type_name}}</view>
|
||||
<view v-if="(item.desc || null) != null" class="desc margin-top-xs cr-gray single-text">{{item.desc}}
|
||||
</view>
|
||||
<view v-if="(item.use_limit_type_name || null) != null" class="base-tips cr-base single-text">{{item.use_limit_type_name}}</view>
|
||||
<view v-if="(item.desc || null) != null" class="desc margin-top-xs cr-gray single-text">{{item.desc}}</view>
|
||||
</view>
|
||||
<view class="v-right fr" @tap="coupon_receive_event" :data-index="index" :data-value="item.id" :style="'background:' + item.bg_color_value + ';'">
|
||||
<text class="circle"></text>
|
||||
|
|
@ -427,9 +423,9 @@
|
|||
import componentQuickNav from "../../components/quick-nav/quick-nav";
|
||||
import componentPopup from "../../components/popup/popup";
|
||||
import componentBadge from "../../components/badge/badge";
|
||||
import componentTrnNav from "../../components/trn-nav/trn-nav";
|
||||
import componentCountdown from "../../components/countdown/countdown";
|
||||
import componentNoData from "../../components/no-data/no-data";
|
||||
import componentTrnNav from "../../components/trn-nav/trn-nav";
|
||||
import componentBottomLine from "../../components/bottom-line/bottom-line";
|
||||
import componentOnlineService from "../../components/online-service/online-service";
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,147 @@
|
|||
/**
|
||||
* 排序导航
|
||||
*/
|
||||
.nav-sort {
|
||||
background: #eee;
|
||||
}
|
||||
.nav-sort-content .item {
|
||||
height: 80rpx;
|
||||
line-height: 80rpx;
|
||||
width: 130rpx;
|
||||
}
|
||||
.nav-sort-content .item .icon {
|
||||
width: 30rpx;
|
||||
height: 30rpx;
|
||||
}
|
||||
.nav-sort-content .item text,
|
||||
.nav-sort-content .item image {
|
||||
vertical-align: middle;
|
||||
}
|
||||
.screening-submit {
|
||||
width: 50rpx;
|
||||
height: 50rpx;
|
||||
position: absolute;
|
||||
top: 15rpx;
|
||||
right: 20rpx;
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品列表
|
||||
*/
|
||||
.scroll-box {
|
||||
height: calc(100vh - 80rpx);
|
||||
}
|
||||
.data-list {
|
||||
overflow: hidden;
|
||||
}
|
||||
.data-list .items {
|
||||
width: calc(50% - 50rpx);
|
||||
}
|
||||
.data-list .items:nth-child(2n) {
|
||||
float: right;
|
||||
}
|
||||
.data-list .items:nth-child(2n+1) {
|
||||
float: left;
|
||||
}
|
||||
.data-list .items image {
|
||||
width: 100%;
|
||||
height: 300rpx !important;
|
||||
}
|
||||
|
||||
/**
|
||||
* 条件
|
||||
*/
|
||||
.search-map {
|
||||
height: calc(100vh - 118rpx);
|
||||
width: 660rpx;
|
||||
overflow-y: scroll;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
.map-keywords {
|
||||
padding: 0 20rpx;
|
||||
line-height: 66rpx;
|
||||
height: 66rpx;
|
||||
font-size: 26rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.map-nav {
|
||||
position: relative;
|
||||
}
|
||||
.map-nav text:first-child {
|
||||
font-weight: bold;
|
||||
}
|
||||
.map-nav .arrow-bottom {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 10rpx;
|
||||
padding-right: 46rpx;
|
||||
color: #999;
|
||||
}
|
||||
.map-item {
|
||||
line-height: 66rpx;
|
||||
}
|
||||
.map-content {
|
||||
line-height: 60rpx;
|
||||
}
|
||||
.map-content .item {
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
.map-content .item:not(:last-child) {
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
.map-text-items .item,
|
||||
.map-images-text-items .item {
|
||||
padding: 0 15rpx;
|
||||
border: 1px solid transparent;
|
||||
}
|
||||
.map-images-text-items .item {
|
||||
vertical-align: middle;
|
||||
border: 1px solid #eee;
|
||||
width: 150rpx;
|
||||
height: 72rpx;
|
||||
line-height: 72rpx;
|
||||
}
|
||||
.map-images-text-items .item image {
|
||||
width: 150rpx;
|
||||
height: calc(100% - 8rpx);
|
||||
display: block;
|
||||
margin: 0 auto;
|
||||
margin-top: 4rpx;
|
||||
}
|
||||
.search-map .search-submit {
|
||||
height: 80rpx;
|
||||
line-height: 80rpx;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
font-size: 32rpx;
|
||||
}
|
||||
|
||||
/**
|
||||
* 品牌基础信息
|
||||
*/
|
||||
.brand-info {
|
||||
height: 160rpx;
|
||||
}
|
||||
.brand-info image,
|
||||
.brand-info .info-logo-empty {
|
||||
width: 300rpx;
|
||||
height: 130rpx;
|
||||
border: 1px solid #eee;
|
||||
}
|
||||
.brand-info .info-logo-empty {
|
||||
line-height: 130rpx;
|
||||
font-weight: bold;
|
||||
}
|
||||
.brand-info .info-right {
|
||||
width: calc(100% - 330rpx);
|
||||
}
|
||||
.brand-info .info-name {
|
||||
line-height: 56rpx;
|
||||
font-weight: bold;
|
||||
}
|
||||
.brand-info .info-desc {
|
||||
font-size: 28rpx;
|
||||
line-height: 40rpx;
|
||||
min-height: 80rpx;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
Before Width: | Height: | Size: 1.2 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 3.0 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 2.8 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 2.9 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 3.6 KiB |
Loading…
Reference in New Issue