前端收货地址管理,未登录拦截
This commit is contained in:
parent
dc35283341
commit
0aed15b629
@ -113,6 +113,13 @@
|
|||||||
"pathName": "pages/winery/winery-detail",
|
"pathName": "pages/winery/winery-detail",
|
||||||
"query": "",
|
"query": "",
|
||||||
"scene": null
|
"scene": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 9,
|
||||||
|
"name": "地址管理",
|
||||||
|
"pathName": "pages/mall/user/user-address",
|
||||||
|
"query": "",
|
||||||
|
"scene": null
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.boom {
|
.boom {
|
||||||
background-color: #F0F1F2;
|
background-color: #F0F1F2;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@ -101,7 +102,9 @@ pages: [
|
|||||||
'pages/form6',
|
'pages/form6',
|
||||||
'pages/mall/index',
|
'pages/mall/index',
|
||||||
'pages/mall/goods-detail',
|
'pages/mall/goods-detail',
|
||||||
|
'pages/mall/user/user-address',
|
||||||
'pages/winery/winery-detail'
|
'pages/winery/winery-detail'
|
||||||
|
|
||||||
],
|
],
|
||||||
navigateToMiniProgramAppIdList: [
|
navigateToMiniProgramAppIdList: [
|
||||||
'wx88736d7d39e2eda6'
|
'wx88736d7d39e2eda6'
|
||||||
@ -143,7 +146,8 @@ usingComponents: {
|
|||||||
"van-grid-item": "./vant/grid-item/index",
|
"van-grid-item": "./vant/grid-item/index",
|
||||||
"van-dialog": "./vant/dialog/index",
|
"van-dialog": "./vant/dialog/index",
|
||||||
"van-image": "./vant/image/index",
|
"van-image": "./vant/image/index",
|
||||||
"van-loading": "./vant/loading/index"
|
"van-loading": "./vant/loading/index",
|
||||||
|
"van-area": "./vant/area/index"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</config>
|
</config>
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
|
|
||||||
import store from '@/store'
|
import store from '@/store'
|
||||||
|
import eventHub from './common/eventHub'
|
||||||
|
|
||||||
class AppManager {
|
class AppManager {
|
||||||
saveOpenid(openid) {
|
saveOpenid(openid) {
|
||||||
wx.setStorageSync('openid', openid)
|
|
||||||
store.dispatch('setOpenidAction', openid)
|
store.dispatch('setOpenidAction', openid)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -12,6 +13,16 @@ class AppManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
navigateTo(url) {
|
navigateTo(url) {
|
||||||
|
if (!store.state.user.token) {
|
||||||
|
eventHub.$emit('onShowDialogUserInfo')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!url) {
|
||||||
|
this.showToast('建设中')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
wx.navigateTo({
|
wx.navigateTo({
|
||||||
url: url
|
url: url
|
||||||
})
|
})
|
||||||
|
@ -140,7 +140,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<span v-if="columnRecord.length > 0" style="margin:15px 0;font-weight: bold;">热门活动</span>
|
<span style="margin:15px 0;font-weight: bold;">热门活动</span>
|
||||||
|
|
||||||
<van-image width="100%" height="60px" :src="navDefine.HOME_BANNER.image" />
|
<van-image width="100%" height="60px" :src="navDefine.HOME_BANNER.image" />
|
||||||
|
|
||||||
@ -169,7 +169,7 @@ import defaultMix from '../../../mixins/defaultMix'
|
|||||||
wepy.component({
|
wepy.component({
|
||||||
store,
|
store,
|
||||||
hooks: {},
|
hooks: {},
|
||||||
mixins: [defaultMix],
|
|
||||||
data: {
|
data: {
|
||||||
columnRecord: [
|
columnRecord: [
|
||||||
{
|
{
|
||||||
@ -180,6 +180,8 @@ wepy.component({
|
|||||||
]
|
]
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
mixins: [defaultMix],
|
||||||
computed: {
|
computed: {
|
||||||
...mapState({
|
...mapState({
|
||||||
'imageDefine': state => state.imageDefine,
|
'imageDefine': state => state.imageDefine,
|
||||||
|
@ -1,38 +1,142 @@
|
|||||||
<style lang="less">
|
<style lang="less">
|
||||||
|
|
||||||
.header {
|
|
||||||
|
.header-image {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 536rpx;
|
height: 200px;
|
||||||
z-index: -10;
|
z-index: -1;
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-info {
|
||||||
|
margin-top: 100px;
|
||||||
|
margin-left: 20px;
|
||||||
|
margin-right: 20px;
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-info-msg {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
margin-left: 10px;
|
||||||
|
justify-content: center;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header-grid-body-top {
|
||||||
|
|
||||||
|
padding: 20px;
|
||||||
|
border: transparent 1px solid;
|
||||||
|
border-top-left-radius: 20px;
|
||||||
|
border-top-right-radius: 20px;
|
||||||
|
width: 660rpx;
|
||||||
|
margin-top: 20px;
|
||||||
|
box-shadow: 4px 4px 10px #eeeeee;
|
||||||
|
background-color: orange;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header-grid-body-bottom {
|
||||||
|
border: transparent 1px solid;
|
||||||
|
border-bottom-left-radius: 20px;
|
||||||
|
border-bottom-right-radius: 20px;
|
||||||
|
width: 660rpx;
|
||||||
|
background-color: #ffffff;
|
||||||
|
box-shadow: 4px 4px 10px #eeeeee;
|
||||||
|
padding: 10px 10px 0px 10px;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.grid-body {
|
||||||
|
border: #fff 1px solid;
|
||||||
|
border-radius: 20px;
|
||||||
|
width: 660rpx;
|
||||||
|
margin-top: 20px;
|
||||||
|
background-color: white;
|
||||||
|
box-shadow: 4px 4px 10px #eeeeee;
|
||||||
|
padding: 10px 10px 0px 10px;
|
||||||
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
<template>
|
<template>
|
||||||
<div>my</div>
|
|
||||||
|
<image class="header-image" :src="imageDefine.HOME_TITLE_IMAGE" />
|
||||||
|
|
||||||
|
|
||||||
|
<div class="container" style="margin: 10px;">
|
||||||
|
|
||||||
|
|
||||||
|
<div class="user-info">
|
||||||
|
<van-image round width="120rpx" height="120rpx" :src="user.userInfo.avatar" />
|
||||||
|
<div class="user-info-msg">
|
||||||
|
<span style="font-size: 18px;">{{user.mobile}}</span>
|
||||||
|
<span style="font-size: 12px;">{{user.userInfo.nickName}}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="header-grid-body-top">
|
||||||
|
<div style="display: flex;">
|
||||||
|
<span>{{user.userInfo.nickName}} </span>
|
||||||
|
<van-tag round type="primary">标签</van-tag>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="header-grid-body-bottom">
|
||||||
|
<van-grid column-num="3" border="{{ false }}" style="margin-top: 15px;">
|
||||||
|
<van-grid-item use-slot v-for=" (item, index) in navDefine.HOME_MENU_LIST" @tap="onNavItem(item)">
|
||||||
|
<van-image round width="120rpx" height="120rpx" :src="item.icon" />
|
||||||
|
<span style="margin-top: 10px;">{{item.name}} </span>
|
||||||
|
</van-grid-item>
|
||||||
|
</van-grid>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="grid-body">
|
||||||
|
<span style="margin:25px 10px 15px 10px;font-weight: bold;">常用功能</span>
|
||||||
|
<van-grid column-num="3" border="{{ false }}" style="margin-top: 15px;">
|
||||||
|
<van-grid-item use-slot v-for=" (item, index) in navDefine.HOME_MENU_LIST" @tap="onNavItem(item)">
|
||||||
|
<van-image round width="120rpx" height="120rpx" :src="item.icon" />
|
||||||
|
<span style="margin-top: 10px;">{{item.name}} </span>
|
||||||
|
</van-grid-item>
|
||||||
|
</van-grid>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="grid-body">
|
||||||
|
<span style="margin:25px 10px 15px 10px;font-weight: bold;">更多推荐</span>
|
||||||
|
<van-grid column-num="3" border="{{ false }}" style="margin-top: 15px;">
|
||||||
|
<van-grid-item use-slot v-for=" (item, index) in navDefine.HOME_MENU_LIST" @tap="onNavItem(item)">
|
||||||
|
<van-image round width="120rpx" height="120rpx" :src="item.icon" />
|
||||||
|
<span style="margin-top: 10px;">{{item.name}} </span>
|
||||||
|
</van-grid-item>
|
||||||
|
</van-grid>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import wepy from '@wepy/core'
|
import wepy from '@wepy/core'
|
||||||
import store from '@/store'
|
import store from '@/store'
|
||||||
import { mapActions } from '@wepy/x'
|
|
||||||
|
import { mapActions, mapState } from '@wepy/x'
|
||||||
|
import defaultMix from '../../../mixins/defaultMix'
|
||||||
|
|
||||||
wepy.component({
|
wepy.component({
|
||||||
store,
|
store,
|
||||||
hooks: {
|
hooks: {},
|
||||||
},
|
|
||||||
|
|
||||||
data: {
|
data: {
|
||||||
active: 0
|
active: 0
|
||||||
},
|
},
|
||||||
|
mixins: [defaultMix],
|
||||||
computed: {
|
computed: {
|
||||||
|
...mapState({
|
||||||
|
'imageDefine': state => state.imageDefine,
|
||||||
|
'user': state => state.user,
|
||||||
|
'navDefine': state => state.navDefine
|
||||||
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {},
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
ready() {
|
ready() {
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ export default {
|
|||||||
|
|
||||||
onNavItem (item) {
|
onNavItem (item) {
|
||||||
console.log(item)
|
console.log(item)
|
||||||
// appManager.navigateTo(item.path)
|
appManager.navigateTo(item.path)
|
||||||
},
|
},
|
||||||
navBack() {
|
navBack() {
|
||||||
wx.navigateBack()
|
wx.navigateBack()
|
||||||
|
@ -134,7 +134,8 @@ wepy.page({
|
|||||||
|
|
||||||
wx.getUserInfo({
|
wx.getUserInfo({
|
||||||
success(res) {
|
success(res) {
|
||||||
self.setUserAction({
|
console.log(res)
|
||||||
|
self.setOpenid({
|
||||||
openid: appManager.getOpenid(),
|
openid: appManager.getOpenid(),
|
||||||
userInfo: res.userInfo
|
userInfo: res.userInfo
|
||||||
})
|
})
|
||||||
|
@ -89,12 +89,11 @@ module.exports.getTime = getTime;
|
|||||||
我的
|
我的
|
||||||
</van-tabbar-item>
|
</van-tabbar-item>
|
||||||
</van-tabbar>
|
</van-tabbar>
|
||||||
<mall-home v-if="pageIndex === 0" />
|
<mall-home v-if="pageIndex === 3" />
|
||||||
<mall-shopping v-else-if="pageIndex === 1" />
|
<mall-shopping v-else-if="pageIndex === 1" />
|
||||||
<mall-bbs v-else-if="pageIndex === 2" />
|
<mall-bbs v-else-if="pageIndex === 2" />
|
||||||
<mall-my v-else-if="pageIndex === 3" />
|
<mall-my v-else-if="pageIndex === 0" />
|
||||||
<dialog-registration />
|
<dialog-registration />
|
||||||
<van-button @tap="onTest">测试</van-button>
|
|
||||||
|
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
@ -120,7 +119,7 @@ wepy.page({
|
|||||||
computed: {
|
computed: {
|
||||||
...mapState({
|
...mapState({
|
||||||
'imageDefine': state => state.imageDefine,
|
'imageDefine': state => state.imageDefine,
|
||||||
'userInfo': state => state.user.userInfo
|
'user': state => state.user
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -130,9 +129,6 @@ wepy.page({
|
|||||||
'setTokenAction',
|
'setTokenAction',
|
||||||
'setOpenidAction'
|
'setOpenidAction'
|
||||||
]),
|
]),
|
||||||
onTest() {
|
|
||||||
eventHub.$emit('onShowDialogUserInfo')
|
|
||||||
},
|
|
||||||
handleViewTap() {
|
handleViewTap() {
|
||||||
console.log('handleVieTap clicked')
|
console.log('handleVieTap clicked')
|
||||||
},
|
},
|
||||||
@ -140,6 +136,10 @@ wepy.page({
|
|||||||
|
|
||||||
},
|
},
|
||||||
onChange(event) {
|
onChange(event) {
|
||||||
|
if (!this.user.token) {
|
||||||
|
eventHub.$emit('onShowDialogUserInfo')
|
||||||
|
return
|
||||||
|
}
|
||||||
this.pageIndex = event.$wx.detail
|
this.pageIndex = event.$wx.detail
|
||||||
},
|
},
|
||||||
callAppLaunch() {
|
callAppLaunch() {
|
||||||
|
224
mini-app/src/pages/mall/user/user-address-list.wpy
Normal file
224
mini-app/src/pages/mall/user/user-address-list.wpy
Normal file
@ -0,0 +1,224 @@
|
|||||||
|
<style lang="less">
|
||||||
|
|
||||||
|
|
||||||
|
.address-item {
|
||||||
|
border: #fff 1px solid;
|
||||||
|
border-radius: 20px;
|
||||||
|
width: 660rpx;
|
||||||
|
margin-top: 20px;
|
||||||
|
background-color: white;
|
||||||
|
box-shadow: 4px 4px 10px #eeeeee;
|
||||||
|
padding: 10px 10px 0px 10px;
|
||||||
|
font-weight: bold;
|
||||||
|
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
//align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
input {
|
||||||
|
|
||||||
|
margin: 12px 15px;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cell-title {
|
||||||
|
padding: 10px 16px;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cell {
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cell-input {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
margin-right: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cell-item {
|
||||||
|
margin-left: 22px;
|
||||||
|
margin-top: 12px;
|
||||||
|
width: 300rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
|
<template>
|
||||||
|
|
||||||
|
<nav-bar :title="title" />
|
||||||
|
<div class="container">
|
||||||
|
|
||||||
|
|
||||||
|
<div class="address-item">
|
||||||
|
<div class="cell">
|
||||||
|
<span class="cell-title">选择收货地区</span>
|
||||||
|
<radio-group bindchange="onChangeCountry" style="display: flex;">
|
||||||
|
<div class="cell-item" v-for="(item,index) in countryTypes">
|
||||||
|
<radio :value="item" :checked="item === radio" color="#AC3016">{{item}}</radio>
|
||||||
|
<span>{{item}} </span>
|
||||||
|
</div>
|
||||||
|
</radio-group>
|
||||||
|
|
||||||
|
<van-divider customStyle="margin: 10px 5px;" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-if="radio=== '国内'" class="cell">
|
||||||
|
<span class="cell-title">收货地址(省市区)</span>
|
||||||
|
<div style="display: flex;width: 100%;">
|
||||||
|
<picker mode="region" v-model="form.region" bindchange="bindRegionChange" style="width: 700rpx;">
|
||||||
|
<van-field
|
||||||
|
:value="form.region"
|
||||||
|
required
|
||||||
|
center
|
||||||
|
clearable
|
||||||
|
readonly
|
||||||
|
placeholder="请选择"
|
||||||
|
border="{{ false }}"
|
||||||
|
/>
|
||||||
|
</picker>
|
||||||
|
<van-icon name="arrow" color="#dddddd" />
|
||||||
|
</div>
|
||||||
|
<van-divider customStyle="margin: 0 5px;" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="cell">
|
||||||
|
<span class="cell-title">详细地址</span>
|
||||||
|
<van-field
|
||||||
|
:value="form.address"
|
||||||
|
required
|
||||||
|
center
|
||||||
|
clearable
|
||||||
|
type="textarea"
|
||||||
|
autosize
|
||||||
|
placeholder="请输入详细地址"
|
||||||
|
bind:change="onChangeAddress"
|
||||||
|
/>
|
||||||
|
<van-divider customStyle="margin: 0 5px;" />
|
||||||
|
</div>
|
||||||
|
<div class="cell">
|
||||||
|
<span class="cell-title">收货人手机号码</span>
|
||||||
|
<van-field
|
||||||
|
:value="form.mobile"
|
||||||
|
required
|
||||||
|
center
|
||||||
|
clearable
|
||||||
|
type="number"
|
||||||
|
placeholder="请输入手机联系电话号码"
|
||||||
|
bind:change="onChangeMobile"
|
||||||
|
/>
|
||||||
|
<van-divider customStyle="margin: 0 5px;" />
|
||||||
|
</div>
|
||||||
|
<div class="cell">
|
||||||
|
<span class="cell-title">收货人姓名</span>
|
||||||
|
<van-field
|
||||||
|
:value="form.name"
|
||||||
|
required
|
||||||
|
center
|
||||||
|
clearable
|
||||||
|
placeholder="请输入收货人姓名"
|
||||||
|
bind:change="onChangeName"
|
||||||
|
/>
|
||||||
|
<van-divider customStyle="margin: 0 5px;" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<van-button round type="info" size="large" style="margin: 20px;" @tap="onSubmit">保存</van-button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import wepy from '@wepy/core'
|
||||||
|
import store from '@/store'
|
||||||
|
|
||||||
|
import { mapActions, mapState } from '@wepy/x'
|
||||||
|
import defaultMix from '../../../mixins/defaultMix'
|
||||||
|
import appManager from '../../../appManager'
|
||||||
|
|
||||||
|
wepy.page({
|
||||||
|
store,
|
||||||
|
hooks: {},
|
||||||
|
data: {
|
||||||
|
title: '添加地址',
|
||||||
|
countryTypes: ['国内', '海外'],
|
||||||
|
form: {
|
||||||
|
region: ['宁夏回族自治区', '银川市', '西夏区'],
|
||||||
|
address: '',
|
||||||
|
mobile: '',
|
||||||
|
name: ''
|
||||||
|
},
|
||||||
|
radio: '国内'
|
||||||
|
|
||||||
|
},
|
||||||
|
mixins: [defaultMix],
|
||||||
|
computed: {
|
||||||
|
...mapState({
|
||||||
|
'imageDefine': state => state.imageDefine,
|
||||||
|
'user': state => state.user,
|
||||||
|
'navDefine': state => state.navDefine,
|
||||||
|
'userAddress': state => state.userAddress
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
bindRegionChange(e) {
|
||||||
|
this.form.region = e.$wx.detail.value
|
||||||
|
},
|
||||||
|
onChangeCountry(e) {
|
||||||
|
this.radio = e.$wx.detail.value
|
||||||
|
if (this.radio === '海外') {
|
||||||
|
this.form.region = ['海外']
|
||||||
|
} else {
|
||||||
|
this.form.region = ['宁夏回族自治区', '银川市', '西夏区']
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
onSubmit() {
|
||||||
|
|
||||||
|
console.log(this.form)
|
||||||
|
if (this.form.region.length < 1) {
|
||||||
|
appManager.showToast('请选择收货地区!')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this.form.address) {
|
||||||
|
appManager.showToast('请输入收货详细地址!')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (!this.form.mobile) {
|
||||||
|
appManager.showToast('请输入收货人手机号码!')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (!this.form.name) {
|
||||||
|
appManager.showToast('请输入收货人姓名!')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO 提交
|
||||||
|
this.navBack()
|
||||||
|
},
|
||||||
|
onChangeAddress(e) {
|
||||||
|
this.form.address = e.$wx.detail
|
||||||
|
},
|
||||||
|
onChangeMobile(e) {
|
||||||
|
this.form.mobile = e.$wx.detail
|
||||||
|
},
|
||||||
|
onChangeName(e) {
|
||||||
|
this.form.name = e.$wx.detail
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
ready() {
|
||||||
|
this.form.mobile = this.user.mobile
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
<config>
|
||||||
|
{
|
||||||
|
navigationBarTitleText: ''
|
||||||
|
}
|
||||||
|
</config>
|
230
mini-app/src/pages/mall/user/user-address.wpy
Normal file
230
mini-app/src/pages/mall/user/user-address.wpy
Normal file
@ -0,0 +1,230 @@
|
|||||||
|
<style lang="less">
|
||||||
|
|
||||||
|
|
||||||
|
.address-item {
|
||||||
|
border: #fff 1px solid;
|
||||||
|
border-radius: 20px;
|
||||||
|
width: 660rpx;
|
||||||
|
margin-top: 20px;
|
||||||
|
background-color: white;
|
||||||
|
box-shadow: 4px 4px 10px #eeeeee;
|
||||||
|
padding: 10px 10px 0px 10px;
|
||||||
|
font-weight: bold;
|
||||||
|
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
//align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
input {
|
||||||
|
|
||||||
|
margin: 12px 15px;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cell-title {
|
||||||
|
padding: 10px 16px;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cell {
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cell-input {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
margin-right: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cell-item {
|
||||||
|
margin-left: 22px;
|
||||||
|
margin-top: 12px;
|
||||||
|
width: 300rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
|
<template>
|
||||||
|
|
||||||
|
<nav-bar :title="title" />
|
||||||
|
<div class="container">
|
||||||
|
|
||||||
|
|
||||||
|
<div class="address-item">
|
||||||
|
<div class="cell">
|
||||||
|
<span class="cell-title">选择收货地区</span>
|
||||||
|
<radio-group bindchange="onChangeCountry" style="display: flex;">
|
||||||
|
<div class="cell-item" v-for="(item,index) in countryTypes">
|
||||||
|
<radio :value="item" :checked="item === radio" color="#AC3016">{{item}}</radio>
|
||||||
|
<span>{{item}} </span>
|
||||||
|
</div>
|
||||||
|
</radio-group>
|
||||||
|
|
||||||
|
<van-divider customStyle="margin: 10px 5px;" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-if="radio=== '国内'" class="cell">
|
||||||
|
<span class="cell-title">收货地址(省市区)</span>
|
||||||
|
<div style="display: flex;width: 100%;">
|
||||||
|
<picker mode="region" v-model="form.region" bindchange="bindRegionChange" style="width: 700rpx;">
|
||||||
|
<van-field
|
||||||
|
:value="form.region"
|
||||||
|
required
|
||||||
|
center
|
||||||
|
clearable
|
||||||
|
readonly
|
||||||
|
placeholder="请选择"
|
||||||
|
border="{{ false }}"
|
||||||
|
/>
|
||||||
|
</picker>
|
||||||
|
<van-icon name="arrow" color="#dddddd" />
|
||||||
|
</div>
|
||||||
|
<van-divider customStyle="margin: 0 5px;" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="cell">
|
||||||
|
<span class="cell-title">详细地址</span>
|
||||||
|
<van-field
|
||||||
|
:value="form.address"
|
||||||
|
required
|
||||||
|
center
|
||||||
|
clearable
|
||||||
|
type="textarea"
|
||||||
|
autosize
|
||||||
|
placeholder="请输入详细地址"
|
||||||
|
bind:change="onChangeAddress"
|
||||||
|
/>
|
||||||
|
<van-divider customStyle="margin: 0 5px;" />
|
||||||
|
</div>
|
||||||
|
<div class="cell">
|
||||||
|
<span class="cell-title">收货人手机号码</span>
|
||||||
|
<van-field
|
||||||
|
:value="form.mobile"
|
||||||
|
required
|
||||||
|
center
|
||||||
|
clearable
|
||||||
|
type="number"
|
||||||
|
placeholder="请输入手机联系电话号码"
|
||||||
|
bind:change="onChangeMobile"
|
||||||
|
/>
|
||||||
|
<van-divider customStyle="margin: 0 5px;" />
|
||||||
|
</div>
|
||||||
|
<div class="cell">
|
||||||
|
<span class="cell-title">收货人姓名</span>
|
||||||
|
<van-field
|
||||||
|
:value="form.name"
|
||||||
|
required
|
||||||
|
center
|
||||||
|
clearable
|
||||||
|
placeholder="请输入收货人姓名"
|
||||||
|
bind:change="onChangeName"
|
||||||
|
/>
|
||||||
|
<van-divider customStyle="margin: 0 5px;" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<van-button round type="info" size="large" style="margin: 20px;" @tap="onSubmit">保存</van-button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import wepy from '@wepy/core'
|
||||||
|
import store from '@/store'
|
||||||
|
|
||||||
|
import { mapActions, mapState } from '@wepy/x'
|
||||||
|
import defaultMix from '../../../mixins/defaultMix'
|
||||||
|
import appManager from '../../../appManager'
|
||||||
|
|
||||||
|
wepy.page({
|
||||||
|
store,
|
||||||
|
hooks: {},
|
||||||
|
data: {
|
||||||
|
title: '添加地址',
|
||||||
|
countryTypes: ['国内', '海外'],
|
||||||
|
form: {
|
||||||
|
region: ['宁夏回族自治区', '银川市', '西夏区'],
|
||||||
|
address: '',
|
||||||
|
mobile: '',
|
||||||
|
name: ''
|
||||||
|
},
|
||||||
|
radio: '国内'
|
||||||
|
|
||||||
|
},
|
||||||
|
mixins: [defaultMix],
|
||||||
|
computed: {
|
||||||
|
...mapState({
|
||||||
|
'imageDefine': state => state.imageDefine,
|
||||||
|
'user': state => state.user,
|
||||||
|
'navDefine': state => state.navDefine,
|
||||||
|
'userAddress': state => state.userAddress
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
bindRegionChange(e) {
|
||||||
|
this.form.region = e.$wx.detail.value
|
||||||
|
},
|
||||||
|
onChangeCountry(e) {
|
||||||
|
this.radio = e.$wx.detail.value
|
||||||
|
if (this.radio === '海外') {
|
||||||
|
this.form.region = ['海外']
|
||||||
|
} else {
|
||||||
|
this.form.region = ['宁夏回族自治区', '银川市', '西夏区']
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
onSubmit() {
|
||||||
|
|
||||||
|
console.log(this.form)
|
||||||
|
if (this.form.region.length < 1) {
|
||||||
|
appManager.showToast('请选择收货地区!')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this.form.address) {
|
||||||
|
appManager.showToast('请输入收货详细地址!')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (!this.form.mobile) {
|
||||||
|
appManager.showToast('请输入收货人手机号码!')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(/^1[3|4|5|6|8][0-9]\d{4,8}$/.test(this.form.mobile))){
|
||||||
|
appManager.showToast('请输入正确的手机号码!')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this.form.name) {
|
||||||
|
appManager.showToast('请输入收货人姓名!')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO 提交
|
||||||
|
this.navBack()
|
||||||
|
},
|
||||||
|
onChangeAddress(e) {
|
||||||
|
this.form.address = e.$wx.detail
|
||||||
|
},
|
||||||
|
onChangeMobile(e) {
|
||||||
|
this.form.mobile = e.$wx.detail
|
||||||
|
},
|
||||||
|
onChangeName(e) {
|
||||||
|
this.form.name = e.$wx.detail
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
ready() {
|
||||||
|
this.form.mobile = this.user.mobile
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
<config>
|
||||||
|
{
|
||||||
|
navigationBarTitleText: ''
|
||||||
|
}
|
||||||
|
</config>
|
13
mini-app/src/store/constant/userAddress.js
Normal file
13
mini-app/src/store/constant/userAddress.js
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
|
||||||
|
export const userAddress = {
|
||||||
|
records: [
|
||||||
|
{
|
||||||
|
id: '1',
|
||||||
|
name: '贺兰神',
|
||||||
|
region: [],
|
||||||
|
detail: '森林公园XXXXXXXXXX'
|
||||||
|
}
|
||||||
|
|
||||||
|
]
|
||||||
|
|
||||||
|
}
|
@ -3,12 +3,13 @@ import { wineryForm } from './wineryForm'
|
|||||||
import { imageDefine } from './constant/imageDefine'
|
import { imageDefine } from './constant/imageDefine'
|
||||||
import { navDefine } from './constant/navDefine'
|
import { navDefine } from './constant/navDefine'
|
||||||
import { wineryDefine } from './constant/wineryDefine'
|
import { wineryDefine } from './constant/wineryDefine'
|
||||||
|
import { userAddress } from './constant/userAddress'
|
||||||
|
|
||||||
export default new Vuex.Store({
|
export default new Vuex.Store({
|
||||||
state: {
|
state: {
|
||||||
user: {
|
user: {
|
||||||
openid: '',
|
openid: '',
|
||||||
mobile: '',
|
mobile: '15595184707',
|
||||||
userInfo: {
|
userInfo: {
|
||||||
nickName: '未注册用户',
|
nickName: '未注册用户',
|
||||||
avatar: 'https://img.yzcdn.cn/vant/cat.jpeg'
|
avatar: 'https://img.yzcdn.cn/vant/cat.jpeg'
|
||||||
@ -19,7 +20,8 @@ export default new Vuex.Store({
|
|||||||
wineryForm,
|
wineryForm,
|
||||||
imageDefine,
|
imageDefine,
|
||||||
navDefine,
|
navDefine,
|
||||||
wineryDefine
|
wineryDefine,
|
||||||
|
userAddress
|
||||||
},
|
},
|
||||||
mutations: {
|
mutations: {
|
||||||
|
|
||||||
@ -50,12 +52,15 @@ export default new Vuex.Store({
|
|||||||
commit('setUser', user)
|
commit('setUser', user)
|
||||||
},
|
},
|
||||||
setOpenidAction({ commit }, openid) {
|
setOpenidAction({ commit }, openid) {
|
||||||
|
wx.setStorageSync('openid', openid)
|
||||||
commit('setOpenid', openid)
|
commit('setOpenid', openid)
|
||||||
},
|
},
|
||||||
setMobileAction({ commit }, user) {
|
setMobileAction({ commit }, mobile) {
|
||||||
commit('setMobile', user)
|
wx.setStorageSync('mobile', mobile)
|
||||||
|
commit('setMobile', mobile)
|
||||||
},
|
},
|
||||||
setUserInfoAction({ commit }, userInfo) {
|
setUserInfoAction({ commit }, userInfo) {
|
||||||
|
wx.setStorageSync('userInfo', userInfo)
|
||||||
commit('setUserInfo', userInfo)
|
commit('setUserInfo', userInfo)
|
||||||
},
|
},
|
||||||
setTokenAction({ commit }, token) {
|
setTokenAction({ commit }, token) {
|
||||||
|
@ -63,7 +63,7 @@ public class SecurityUtils {
|
|||||||
public static boolean matchesPassword(String rawPassword, String encodedPassword) {
|
public static boolean matchesPassword(String rawPassword, String encodedPassword) {
|
||||||
BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
|
BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
|
||||||
return passwordEncoder.matches(rawPassword, encodedPassword);
|
return passwordEncoder.matches(rawPassword, encodedPassword);
|
||||||
}
|
}o
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否为管理员
|
* 是否为管理员
|
||||||
|
Loading…
x
Reference in New Issue
Block a user