微信小程序支持地址导入
parent
725574412d
commit
c8f08f234d
|
|
@ -221,9 +221,9 @@ class UserAddressService
|
|||
$data = [
|
||||
'name' => $params['name'],
|
||||
'tel' => $params['tel'],
|
||||
'province' => $params['province'],
|
||||
'city' => $params['city'],
|
||||
'county' => $params['county'],
|
||||
'province' => intval($params['province']),
|
||||
'city' => intval($params['city']),
|
||||
'county' => isset($params['county']) ? intval($params['county']) : 0,
|
||||
'address' => $params['address'],
|
||||
'is_default' => $is_default,
|
||||
];
|
||||
|
|
@ -341,11 +341,6 @@ class UserAddressService
|
|||
'key_name' => 'city',
|
||||
'error_msg' => '城市不能为空',
|
||||
],
|
||||
[
|
||||
'checked_type' => 'empty',
|
||||
'key_name' => 'county',
|
||||
'error_msg' => '区/县不能为空',
|
||||
],
|
||||
[
|
||||
'checked_type' => 'empty',
|
||||
'key_name' => 'address',
|
||||
|
|
@ -495,7 +490,7 @@ class UserAddressService
|
|||
// 省市区解析
|
||||
$province_name = $params['province'];
|
||||
$city_name = $params['city'];
|
||||
$county_name = $params['county'];
|
||||
$county_name = isset($params['county']) ? $params['county'] : '';
|
||||
$town_name = isset($params['town']) ? $params['town'] : '';
|
||||
|
||||
// 开始匹配地址
|
||||
|
|
@ -551,15 +546,11 @@ class UserAddressService
|
|||
$where2[] = ['name', 'like', str_replace($search, '', $town_name).'%'];
|
||||
$county = Db::name('Region')->where($where2)->field($field)->find();
|
||||
}
|
||||
if(empty($county))
|
||||
{
|
||||
return DataReturn('区/县匹配失败', -1);
|
||||
}
|
||||
|
||||
// 地区id赋值
|
||||
$params['province'] = $province['id'];
|
||||
$params['city'] = $city['id'];
|
||||
$params['county'] = $county['id'];
|
||||
$params['county'] = empty($county['id']) ? 0 : $county['id'];
|
||||
|
||||
// 存在街道字段数据则拼接到详细地址前面
|
||||
if(!empty($town_name))
|
||||
|
|
|
|||
|
|
@ -10,10 +10,11 @@
|
|||
|
||||
web端
|
||||
1. 后台菜单支持自定义url地址、并支持钩子自动添加
|
||||
2. 统计维度新增当月、上月
|
||||
2. 后台区块数据统计新增当月、上月维度
|
||||
|
||||
小程序
|
||||
1. QQ小程序支持微信支付
|
||||
2. 百度/微信小程序支持手机号码一键绑定、获取收货地址
|
||||
|
||||
插件
|
||||
1. 汇率插件支持货币自由切换
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
</view>
|
||||
<view class="address-detail oh">
|
||||
<image class="icon fl" src="/images/user-address.png" mode="widthFix" />
|
||||
<view class="text fr">{{address.province_name}}{{address.city_name}}{{address.county_name}}{{address.address}}</view>
|
||||
<view class="text fr">{{address.province_name || ''}}{{address.city_name || ''}}{{address.county_name || ''}}{{address.address || ''}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view a:if="{{address == null}}" class="no-address cr-888">
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
</view>
|
||||
<view class="address oh">
|
||||
<image class="item-icon fl" src="/images/user-address.png" mode="widthFix" />
|
||||
<view class="text fr">{{item.province_name}}{{item.city_name}}{{item.county_name}}{{item.address}}</view>
|
||||
<view class="text fr">{{item.province_name || ''}}{{item.city_name || ''}}{{item.county_name || ''}}{{item.address || ''}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="operation br-t oh">
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
</view>
|
||||
<view class="address oh">
|
||||
<image class="item-icon fl" src="/images/user-address.png" mode="widthFix" />
|
||||
<view class="text fr">{{item.province_name}}{{item.city_name}}{{item.county_name}}{{item.address}}</view>
|
||||
<view class="text fr">{{item.province_name || ''}}{{item.city_name || ''}}{{item.county_name || ''}}{{item.address || ''}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="operation br-t oh">
|
||||
|
|
|
|||
|
|
@ -10,11 +10,11 @@ Page({
|
|||
|
||||
onLoad(params) {
|
||||
this.setData({params: params});
|
||||
this.init();
|
||||
},
|
||||
|
||||
onShow() {
|
||||
my.setNavigationBar({title: app.data.common_pages_title.user_address});
|
||||
this.init();
|
||||
},
|
||||
|
||||
// 初始化
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
</view>
|
||||
<view class="address-detail oh">
|
||||
<image class="icon fl" src="/images/user-address.png" mode="widthFix" />
|
||||
<view class="text fr">{{address.province_name}}{{address.city_name}}{{address.county_name}}{{address.address}}</view>
|
||||
<view class="text fr">{{address.province_name || ''}}{{address.city_name || ''}}{{address.county_name || ''}}{{address.address || ''}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view s-if="address == null" class="no-address cr-888">
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
</view>
|
||||
<view class="address oh">
|
||||
<image class="item-icon fl" src="/images/user-address.png" mode="widthFix" />
|
||||
<view class="text fr">{{item.province_name}}{{item.city_name}}{{item.county_name}}{{item.address}}</view>
|
||||
<view class="text fr">{{item.province_name || ''}}{{item.city_name || ''}}{{item.county_name || ''}}{{item.address || ''}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="operation br-t oh">
|
||||
|
|
|
|||
|
|
@ -10,11 +10,11 @@ Page({
|
|||
|
||||
onLoad(params) {
|
||||
this.setData({ params: params });
|
||||
this.init();
|
||||
},
|
||||
|
||||
onShow() {
|
||||
swan.setNavigationBarTitle({ title: app.data.common_pages_title.user_address });
|
||||
this.init();
|
||||
},
|
||||
|
||||
// 初始化
|
||||
|
|
@ -253,7 +253,6 @@ Page({
|
|||
swan.hideLoading();
|
||||
if (res.data.code == 0) {
|
||||
this.get_data_list();
|
||||
app.showToast(res.data.msg, "success");
|
||||
} else {
|
||||
if (app.is_login_check(res.data)) {
|
||||
app.showToast(res.data.msg);
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
</view>
|
||||
<view class="address oh">
|
||||
<image class="item-icon fl" src="/images/user-address.png" mode="widthFix" />
|
||||
<view class="text fr">{{item.province_name}}{{item.city_name}}{{item.county_name}}{{item.address}}</view>
|
||||
<view class="text fr">{{item.province_name || ''}}{{item.city_name || ''}}{{item.county_name || ''}}{{item.address || ''}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="operation br-t oh">
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
</view>
|
||||
<view class="address-detail oh">
|
||||
<image class="icon fl" src="/images/user-address.png" mode="widthFix" />
|
||||
<view class="text fr">{{address.province_name}}{{address.city_name}}{{address.county_name}}{{address.address}}</view>
|
||||
<view class="text fr">{{address.province_name || ''}}{{address.city_name || ''}}{{address.county_name || ''}}{{address.address || ''}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view qq:if="{{address == null}}" class="no-address cr-888">
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
</view>
|
||||
<view class="address oh">
|
||||
<image class="item-icon fl" src="/images/user-address.png" mode="widthFix" />
|
||||
<view class="text fr">{{item.province_name}}{{item.city_name}}{{item.county_name}}{{item.address}}</view>
|
||||
<view class="text fr">{{item.province_name || ''}}{{item.city_name || ''}}{{item.county_name || ''}}{{item.address || ''}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="operation br-t oh">
|
||||
|
|
|
|||
|
|
@ -10,11 +10,11 @@ Page({
|
|||
|
||||
onLoad(params) {
|
||||
this.setData({params: params});
|
||||
this.init();
|
||||
},
|
||||
|
||||
onShow() {
|
||||
qq.setNavigationBarTitle({title: app.data.common_pages_title.user_address});
|
||||
this.init();
|
||||
},
|
||||
|
||||
// 初始化
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
</view>
|
||||
<view class="address oh">
|
||||
<image class="item-icon fl" src="/images/user-address.png" mode="widthFix" />
|
||||
<view class="text fr">{{item.province_name}}{{item.city_name}}{{item.county_name}}{{item.address}}</view>
|
||||
<view class="text fr">{{item.province_name || ''}}{{item.city_name || ''}}{{item.county_name || ''}}{{item.address || ''}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="operation br-t oh">
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
</view>
|
||||
<view class="address-detail oh">
|
||||
<image class="icon fl" src="/images/user-address.png" mode="widthFix" />
|
||||
<view class="text fr">{{address.province_name}}{{address.city_name}}{{address.county_name}}{{address.address}}</view>
|
||||
<view class="text fr">{{address.province_name || ''}}{{address.city_name || ''}}{{address.county_name || ''}}{{address.address || ''}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view tt:if="{{address == null}}" class="no-address cr-888">
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
</view>
|
||||
<view class="address oh">
|
||||
<image class="item-icon fl" src="/images/user-address.png" mode="widthFix" />
|
||||
<view class="text fr">{{item.province_name}}{{item.city_name}}{{item.county_name}}{{item.address}}</view>
|
||||
<view class="text fr">{{item.province_name || ''}}{{item.city_name || ''}}{{item.county_name || ''}}{{item.address || ''}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="operation br-t oh">
|
||||
|
|
|
|||
|
|
@ -10,11 +10,11 @@ Page({
|
|||
|
||||
onLoad(params) {
|
||||
this.setData({params: params});
|
||||
this.init();
|
||||
},
|
||||
|
||||
onShow() {
|
||||
tt.setNavigationBarTitle({title: app.data.common_pages_title.user_address});
|
||||
this.init();
|
||||
},
|
||||
|
||||
// 初始化
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
</view>
|
||||
<view class="address oh">
|
||||
<image class="item-icon fl" src="/images/user-address.png" mode="widthFix" />
|
||||
<view class="text fr">{{item.province_name}}{{item.city_name}}{{item.county_name}}{{item.address}}</view>
|
||||
<view class="text fr">{{item.province_name || ''}}{{item.city_name || ''}}{{item.county_name || ''}}{{item.address || ''}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="operation br-t oh">
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ App({
|
|||
// 请求地址
|
||||
request_url: "{{request_url}}",
|
||||
request_url: 'http://shopxo.com/',
|
||||
// request_url: 'https://dev.shopxo.net/',
|
||||
request_url: 'https://dev.shopxo.net/',
|
||||
|
||||
// 基础信息
|
||||
application_title: "{{application_title}}",
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
</view>
|
||||
<view class="address-detail oh">
|
||||
<image class="icon fl" src="/images/user-address.png" mode="widthFix" />
|
||||
<view class="text fr">{{address.province_name}}{{address.city_name}}{{address.county_name}}{{address.address}}</view>
|
||||
<view class="text fr">{{address.province_name || ''}}{{address.city_name || ''}}{{address.county_name || ''}}{{address.address || ''}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view wx:if="{{address == null}}" class="no-address cr-888">
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
</view>
|
||||
<view class="address oh">
|
||||
<image class="item-icon fl" src="/images/user-address.png" mode="widthFix" />
|
||||
<view class="text fr">{{item.province_name}}{{item.city_name}}{{item.county_name}}{{item.address}}</view>
|
||||
<view class="text fr">{{item.province_name || ''}}{{item.city_name || ''}}{{item.county_name || ''}}{{item.address || ''}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="operation br-t oh">
|
||||
|
|
|
|||
|
|
@ -10,11 +10,11 @@ Page({
|
|||
|
||||
onLoad(params) {
|
||||
this.setData({params: params});
|
||||
this.init();
|
||||
},
|
||||
|
||||
onShow() {
|
||||
wx.setNavigationBarTitle({title: app.data.common_pages_title.user_address});
|
||||
this.init();
|
||||
},
|
||||
|
||||
// 初始化
|
||||
|
|
@ -236,5 +236,57 @@ Page({
|
|||
wx.navigateBack();
|
||||
}
|
||||
},
|
||||
|
||||
// 获取系统地址
|
||||
choose_system_address_event(e) {
|
||||
var self = this;
|
||||
wx.authorize({
|
||||
scope: 'scope.address',
|
||||
success: function(res) {
|
||||
wx.chooseAddress({
|
||||
success (res) {
|
||||
var data = {
|
||||
"name": res.userName || '',
|
||||
"tel": res.telNumber || '',
|
||||
"province": res.provinceName || '',
|
||||
"city": res.cityName || '',
|
||||
"county": res.countyName || '',
|
||||
"address": res.detailInfo || '',
|
||||
};
|
||||
|
||||
// 加载loding
|
||||
wx.showLoading({ title: "处理中..." });
|
||||
|
||||
// 获取数据
|
||||
wx.request({
|
||||
url: app.get_request_url("outsystemadd", "useraddress"),
|
||||
method: "POST",
|
||||
data: data,
|
||||
dataType: "json",
|
||||
success: res => {
|
||||
wx.hideLoading();
|
||||
if (res.data.code == 0) {
|
||||
self.get_data_list();
|
||||
} else {
|
||||
if (app.is_login_check(res.data)) {
|
||||
app.showToast(res.data.msg);
|
||||
} else {
|
||||
app.showToast('提交失败,请重试!');
|
||||
}
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
wx.hideLoading();
|
||||
app.showToast("服务器请求出错");
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
fail: function(res) {
|
||||
app.showToast('取消选择');
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
});
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
</view>
|
||||
<view class="address oh">
|
||||
<image class="item-icon fl" src="/images/user-address.png" mode="widthFix" />
|
||||
<view class="text fr">{{item.province_name}}{{item.city_name}}{{item.county_name}}{{item.address}}</view>
|
||||
<view class="text fr">{{item.province_name || ''}}{{item.city_name || ''}}{{item.county_name || ''}}{{item.address || ''}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="operation br-t oh">
|
||||
|
|
@ -33,8 +33,11 @@
|
|||
|
||||
<import src="/pages/common/bottom_line.wxml" />
|
||||
<template is="bottom_line" data="{{status: data_bottom_line_status}}"></template>
|
||||
|
||||
<navigator url="/pages/user-address-save/user-address-save" open-type="navigate" hover-class="none">
|
||||
<button class="submit-fixed submit-bottom" type="default" hover-class="none">新增地址</button>
|
||||
</navigator>
|
||||
|
||||
<view class="submit-list">
|
||||
<navigator url="/pages/user-address-save/user-address-save" open-type="navigate" hover-class="none">
|
||||
<button class="submit-fixed submit-bottom" type="default" hover-class="none">添加新地址</button>
|
||||
</navigator>
|
||||
<button class="submit-fixed submit-bottom import-system-address-submit" type="default" hover-class="none" bindtap="choose_system_address_event">导入百度地址</button>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -33,4 +33,12 @@
|
|||
}
|
||||
.page {
|
||||
padding-bottom: 85rpx;
|
||||
}
|
||||
.submit-list button {
|
||||
width: 50%;
|
||||
}
|
||||
.submit-list .import-system-address-submit {
|
||||
background: #07c160 !important;
|
||||
right: 0;
|
||||
left: auto;
|
||||
}
|
||||
Loading…
Reference in New Issue