parent
1dbc0c1249
commit
55479046ed
@ -1,553 +0,0 @@ |
||||
<template> |
||||
<view |
||||
class="data-list-components " |
||||
@touchmove.stop.prevent |
||||
> |
||||
<!-- :class="{ 'safe-area-inset-bottom': safeAreaInsetBottom }" --> |
||||
<!-- :style="[dataListStyle]" --> |
||||
<scroll-view |
||||
class="scroll-view" |
||||
:scroll-top="scrollTop" |
||||
:scroll-y="scrollingEnabled" |
||||
:lower-threshold="lowerThreshold" |
||||
:enable-back-to-top="enableBackToTop" |
||||
@scroll="handleScroll" |
||||
@scrolltolower="handleScrolltolower" |
||||
@touchstart="handleTouchStart" |
||||
@touchmove="handleTouchMove" |
||||
@touchend="handleTouchEnd" |
||||
> |
||||
<view class="scroll-content" :style="[scrollContentStyle]"> |
||||
<!-- 下拉 --> |
||||
<view class="pull-down-view"> |
||||
<slot name="refresh" v-if="$slots.refresh"></slot> |
||||
<view class="refresh-view" v-else> |
||||
<text :class="' pull-down-text icon-ymt '+(refreshStatus == 'soon'?' to-blod-down ':refreshStatus == 'sure'?' to-blod-up ':' ') " >{{ refreshText[refreshStatus] }}</text> |
||||
</view> |
||||
</view> |
||||
|
||||
<view class="scroll-list"><slot></slot></view> |
||||
|
||||
<view class="loading-view" v-if="loadingMask"> |
||||
<view class="loading-animation"></view> |
||||
<text class="loading-text">加载中...</text> |
||||
</view> |
||||
|
||||
<!-- 空 --> |
||||
<view class=" empty-content" v-if="showEmpty"> |
||||
<!-- <image class="empty-image" :src="emptyImage || defaultEmptyImage" mode=""></image> --> |
||||
<text class="empty-text">{{ emptyText }}</text> |
||||
</view> |
||||
|
||||
<!-- 底部上滑 --> |
||||
<view class="pull-up-view" > |
||||
<slot name="load" v-if="$slots.load"></slot> |
||||
<view class="load-view" v-else> |
||||
<view class="loading-animation" v-if="loadStatus == 'loading'"></view> |
||||
<text :class="' loading-text icon-ymt '+(loadStatus == 'soon'?' to-blod-up ':loadStatus == 'sure'?' to-blod-down ':' ') " >{{ loadText[loadStatus] }}</text> |
||||
</view> |
||||
</view> |
||||
</view> |
||||
</scroll-view> |
||||
</view> |
||||
</template> |
||||
|
||||
<script> |
||||
/** |
||||
* data-list 数据列表 |
||||
* @description 数据列表展示,上拉加载更多数据,下拉刷新数据 |
||||
* @tips 如果父组件有设置padding,可能造成组件高度不正确的问题 |
||||
* @property {Number, String} page 默认分页 |
||||
* @property {Number, String} size 默认分页大小 |
||||
* @property {Boolean} loading 是否显示首次加载时的loading遮罩层 |
||||
* @property {Boolean} safeAreaInsetBottom 是否开启底部安全区域适配 |
||||
* @property {String} emptyImage 空数据提示图片 |
||||
* @property {String} emptyText 空数据提示文字 |
||||
* @property {Boolean} enableBackToTop iOS点击顶部状态栏、安卓双击标题栏时,滚动条返回顶部 |
||||
* @property {Number, String} refresherThreshold 下拉刷新阈值(单位px),触发 refresherrefresh 事件 |
||||
* @property {Number, String} lowerThreshold 距底部多远时(单位px),触发 scrolltolower 事件 |
||||
* @methods {Function} loadData 加载数据方法 |
||||
* @methods {Function} refreshData 刷新数据方法 |
||||
* @methods {Function} computedHeight 重新计算高度方法(有时候页面某些地方布局被改变了,会造成组件高度不能撑满的问题,就调用此方法) |
||||
* @event {Function} load 加载 事件(参数一:分页请求参数,参数二:回调方法,需要将列表和数据总数回调回去计算 {list:数据列表对象,total:后端数据总数}) |
||||
* @event {Function} refresh 刷新 事件(参数一:分页请求参数,参数二:回调方法,需要将列表和数据总数回调回去计算 {list:数据列表对象,total:后端数据总数}) |
||||
* @event {Function} scroll 滚动 事件 |
||||
* @event {Function} scrolltolower 上拉触底 事件 |
||||
* @event {Function} refresherpulling 正在下拉 事件 |
||||
* @event {Function} refresherrestore 下拉刷新被复位 事件 |
||||
* @event {Function} refresherabort 下拉刷新被终止 事件 |
||||
* @event {Function} refresherrefresh 下拉刷新被触发 事件 |
||||
* @example <data-list class="data-list" ref="list" @load="handleLoad" @refresh="handleRefresh" @scroll="handleScroll"></data-list> |
||||
*/ |
||||
import emptyImages from './emptyImage.js'; |
||||
export default { |
||||
name: 'data-list', |
||||
props: { |
||||
page: { |
||||
type: [Number, String], |
||||
default: 1 |
||||
}, |
||||
size: { |
||||
type: [Number, String], |
||||
default: 15 |
||||
}, |
||||
loading: { |
||||
type: Boolean, |
||||
default: false |
||||
}, |
||||
safeAreaInsetBottom: { |
||||
type: Boolean, |
||||
default: true |
||||
}, |
||||
emptyImage: { |
||||
type: String |
||||
}, |
||||
emptyText: { |
||||
type: String, |
||||
default: '暂无数据~' |
||||
}, |
||||
enableBackToTop: { |
||||
type: Boolean, |
||||
default: false |
||||
}, |
||||
showEmpty:{ |
||||
type: Boolean, |
||||
default: false |
||||
}, |
||||
refresherThreshold: { |
||||
type: [Number, String], |
||||
default: 50 |
||||
}, |
||||
lowerThreshold: { |
||||
type: [Number, String], |
||||
default: 50 |
||||
}, |
||||
selectObject:{ |
||||
type:Object, |
||||
default:{ |
||||
selectIndex:0, |
||||
length:0 |
||||
} |
||||
} |
||||
}, |
||||
data() { |
||||
return { |
||||
list: [], // 数据列表 |
||||
total: -1, // 数据总数 |
||||
currentPage: 1, // 当前分页页码 |
||||
currentSize: 10, // 当前分页大小 |
||||
// showEmpty: false, // 是否显示空数据 |
||||
waiting: false, // 是否等待加载中 |
||||
loadingMask: false, // 是否显示加载中遮罩 |
||||
scrollTop: 0, // 设置竖向滚动条位置 |
||||
currentScrollTop: 0, // 当前竖向滚动条位置 |
||||
scrollingEnabled: true, // 是否启用竖向滚动 |
||||
|
||||
pullingDown: false, // 是否正在下拉 |
||||
pullDownHeight: 0, // 下拉高度 |
||||
pullDownTimeStamp: 0, // 下拉时的时间戳 |
||||
|
||||
pullingUp: false, // 是否正在上拉 |
||||
pullUpHeight: 0, // 上拉高度 |
||||
pullUpTimeStamp: 0, // 上拉时的时间戳 |
||||
|
||||
maxDistance:100, |
||||
touchDirection:'top', |
||||
|
||||
loadStatus: 'soon', |
||||
loadText: { |
||||
loading: '加载中~', |
||||
nomore: '没有更多啦~', |
||||
|
||||
soon: '上滑查看下一分类', |
||||
sure: '释放查看下一分类', |
||||
}, |
||||
refreshStatus: 'soon', |
||||
refreshText: { |
||||
soon: '下滑查看上一分类', |
||||
sure: '释放查看上一分类', |
||||
|
||||
nomore: '没有更多啦~', |
||||
refreshing: '正在刷新中~' |
||||
}, |
||||
defaultEmptyImage: emptyImages.data, |
||||
componentsHeight: 'auto' // 组件高度属性 |
||||
}; |
||||
}, |
||||
watch:{ |
||||
selectObject:{ |
||||
handler(n, o) { |
||||
if(n.selectIndex == n.length-1){ |
||||
this.loadStatus = "nomore" |
||||
}else{ |
||||
this.loadStatus = "soon" |
||||
} |
||||
if(n.selectIndex == 0){ |
||||
this.refreshStatus = "nomore" |
||||
}else{ |
||||
this.refreshStatus = "soon" |
||||
} |
||||
|
||||
}, |
||||
deep:true, // 深度监听 |
||||
immediate:false, // 初始化监听 |
||||
}, |
||||
|
||||
}, |
||||
computed: { |
||||
// dataListStyle() { |
||||
// const { componentsHeight } = this; |
||||
// return { |
||||
// height: componentsHeight |
||||
// }; |
||||
// }, |
||||
scrollContentStyle() { |
||||
const style = {}; |
||||
const { pullDownHeight, pullingDown,pullUpHeight, pullingUp } = this; |
||||
|
||||
// if(this.touchDirection == 'top'){ |
||||
|
||||
style.transform = pullingDown ? `translateY(${pullDownHeight}px)` : `translateY(0px)`; |
||||
style.transition = pullingDown ? `transform .1s linear` : `transform 0.3s cubic-bezier(0.19,1.64,0.42,0.72)`; |
||||
|
||||
|
||||
// }else if(this.touchDirection == 'bottom'){ |
||||
// style.transform = pullingUp ? `translateY(0px)` : `translateY(0px)`; |
||||
|
||||
|
||||
// style.transition = pullingUp ? `transform .1s linear` : `transform 0.3s cubic-bezier(0.19,1.64,0.42,0.72)`; |
||||
// } |
||||
|
||||
return style; |
||||
} |
||||
}, |
||||
mounted() { |
||||
this.handleInit(); |
||||
}, |
||||
methods: { |
||||
// 下滑触底后 数据加载 |
||||
loadData() { |
||||
this.waiting = true; |
||||
|
||||
this.$emit('load',res => { |
||||
this.waiting = false; |
||||
this.list = res.list; |
||||
this.total = res.total; |
||||
this.currentPage++; |
||||
this.handleComputeData(); |
||||
// this.computedHeight(); |
||||
}); |
||||
}, |
||||
|
||||
// 计算高度 |
||||
computedHeight() { |
||||
// this.getRect('.data-list-components').then(res => { |
||||
// console.log(res,"res") |
||||
// // #ifdef H5 |
||||
// this.componentsHeight = `calc(100vh - ${res.top}px - var(--window-top))`; |
||||
// // #endif |
||||
// // #ifndef H5 |
||||
// this.componentsHeight = `calc(100vh - ${res.top}px)`; |
||||
// // #endif |
||||
|
||||
// }); |
||||
}, |
||||
// 计算数据 |
||||
handleComputeData() { |
||||
const len = this.list.length; |
||||
const total = this.total; |
||||
console.log(len,total) |
||||
if (len >= this.total) { |
||||
this.loadStatus = 'soon'; |
||||
} else if (len < this.total) { |
||||
this.loadStatus = 'loading'; |
||||
} |
||||
}, |
||||
// 下滑触底事件 |
||||
handleScrolltolower(e) { |
||||
this.$emit('scrolltolower', e); |
||||
if (this.loadStatus == 'nomore' || this.waiting) return; |
||||
this.loadData(); |
||||
}, |
||||
// 滚动事件 |
||||
handleScroll(e) { |
||||
// this.currentScrollTop = e.detail.scrollTop; |
||||
|
||||
// if (e.detail.scrollTop <= 20) { |
||||
// this.touchDirection = 'top'; |
||||
// } else { |
||||
// this.touchDirection = 'bottom'; |
||||
// } |
||||
// console.log(e.detail.scrollTop) |
||||
this.$emit('scroll', e); |
||||
}, |
||||
// 触摸按下处理 |
||||
handleTouchStart(e) { |
||||
|
||||
// if (e.detail.scrollTop <= 20) { |
||||
|
||||
// } |
||||
// console.log(e) |
||||
|
||||
|
||||
// if(this.touchDirection=='top'){ |
||||
this.pullingDown = true; |
||||
// }else if(this.touchDirection=='bottom'){ |
||||
// this.pullingUp =true; |
||||
// } |
||||
|
||||
this.currentTouchStartY = e.touches[0].clientY; |
||||
}, |
||||
// 触摸按下滑动处理 |
||||
handleTouchMove(e) { |
||||
|
||||
// this.$emit('refresherpulling', e); |
||||
// 顶部下滑 |
||||
console.log(e.touches[0].clientY >= this.currentTouchStartY) |
||||
if (e.touches[0].clientY >= this.currentTouchStartY){ |
||||
this.touchDirection=='top' |
||||
const currentTouchMoveY = e.touches[0].clientY; |
||||
let movingDistance = (currentTouchMoveY - this.currentTouchStartY) ; |
||||
if(this.selectObject.selectIndex == 0){ |
||||
this.refreshStatus = 'nomore' |
||||
} |
||||
else if(movingDistance > this.refresherThreshold){ |
||||
this.refreshStatus = 'sure';// 释放 |
||||
}else{ |
||||
this.refreshStatus = 'soon';// 划 |
||||
} |
||||
let computeDistance = movingDistance; |
||||
if(computeDistance > this.maxDistance){ |
||||
computeDistance = this.maxDistance; |
||||
} |
||||
this.pullDownHeight = computeDistance ; |
||||
}else{ |
||||
// 底部上滑 |
||||
this.touchDirection=='bottom'; |
||||
const currentTouchMoveY = e.touches[0].clientY; |
||||
let movingDistance = (this.currentTouchStartY - currentTouchMoveY ) ; |
||||
if(this.selectObject.selectIndex == this.selectObject.length-1){ |
||||
this.loadStatus = 'nomore'; |
||||
}else if (movingDistance >= this.lowerThreshold) { |
||||
this.loadStatus = 'sure';//释放 |
||||
|
||||
} else { |
||||
this.loadStatus = 'soon';//划 |
||||
|
||||
} |
||||
let computeDistance = movingDistance; |
||||
if(computeDistance > this.maxDistance){ |
||||
computeDistance = this.maxDistance; |
||||
} |
||||
this.pullUpHeight = computeDistance; |
||||
|
||||
} |
||||
|
||||
|
||||
}, |
||||
// 触摸松开处理 |
||||
handleTouchEnd(e) { |
||||
console.log(this.touchDirection) |
||||
// 顶部下滑 |
||||
if(this.touchDirection == 'top'){ |
||||
if(this.pullDownHeight>=this.refresherThreshold&&this.selectObject.selectIndex > 0){ |
||||
this.$emit('refresherrefresh', "prev"); |
||||
} |
||||
this.pullingDown = false; |
||||
this.pullDownHeight = 0; |
||||
// 底部上滑 |
||||
}else if(this.touchDirection == 'bottom'){ |
||||
|
||||
if(this.pullUpHeight>=this.lowerThreshold&&this.selectObject.selectIndex < (this.selectObject.length-1)){ |
||||
this.$emit('refresherrefresh', "next"); |
||||
|
||||
} |
||||
this.pullingUp = false; |
||||
this.pullUpHeight = 0; |
||||
} |
||||
}, |
||||
// 初始化 |
||||
handleInit() { |
||||
this.currentPage = this.page; |
||||
this.currentSize = this.size; |
||||
// console.log() |
||||
// this.computedHeight(); |
||||
}, |
||||
// 查询dom节点信息 |
||||
getRect(selector, all) { |
||||
return new Promise(resolve => { |
||||
uni.createSelectorQuery() |
||||
.in(this) |
||||
[all ? 'selectAll' : 'select'](selector) |
||||
.boundingClientRect(rect => { |
||||
if (all && Array.isArray(rect) && rect.length) { |
||||
resolve(rect); |
||||
} |
||||
if (!all && rect) { |
||||
resolve(rect); |
||||
} |
||||
}) |
||||
.exec(); |
||||
}); |
||||
} |
||||
} |
||||
}; |
||||
</script> |
||||
|
||||
<style scoped lang="scss"> |
||||
.data-list-components { |
||||
height: 100%; |
||||
.scroll-view { |
||||
height: 100%; |
||||
.scroll-content { |
||||
width: 100%; |
||||
height: 100%; |
||||
position: relative; |
||||
.empty-view { |
||||
width: 100%; |
||||
height: 100%; |
||||
display: flex; |
||||
align-items: center; |
||||
justify-content: center; |
||||
|
||||
} |
||||
.empty-content { |
||||
height:calc(100% - 20px) ; |
||||
display: flex; |
||||
align-items: center; |
||||
flex-direction: column; |
||||
justify-content: center; |
||||
.empty-image { |
||||
width: 100%; |
||||
// height: 100%; |
||||
} |
||||
.empty-text { |
||||
|
||||
display: block; |
||||
color: #606266; |
||||
margin-top: 20rpx; |
||||
} |
||||
} |
||||
.pull-down-view { |
||||
top: 0; |
||||
left: 0; |
||||
width: 100%; |
||||
padding: 30rpx 0; |
||||
display: flex; |
||||
position: absolute; |
||||
align-items: center; |
||||
flex-direction: column; |
||||
justify-content: center; |
||||
transform: translateY(-100%); |
||||
.refresh-view { |
||||
display: flex; |
||||
align-items: center; |
||||
flex-direction: column; |
||||
.loading-animation { |
||||
width: 50rpx; |
||||
height: 50rpx; |
||||
} |
||||
.pull-down-text { |
||||
color: #606266; |
||||
font-size: 24rpx; |
||||
margin-top: 10rpx; |
||||
} |
||||
} |
||||
} |
||||
.scroll-list { |
||||
display: flex; |
||||
flex-direction: column; |
||||
} |
||||
.loading-view { |
||||
width: 100%; |
||||
height: 100%; |
||||
display: flex; |
||||
align-items: center; |
||||
flex-direction: column; |
||||
justify-content: center; |
||||
.loading-animation { |
||||
width: 40rpx; |
||||
height: 40rpx; |
||||
} |
||||
.loading-text { |
||||
color: #606266; |
||||
font-size: 24rpx; |
||||
margin-top: 10rpx; |
||||
} |
||||
} |
||||
.pull-up-view { |
||||
width: 100%; |
||||
// padding: 15rpx 0; |
||||
height: 20px; |
||||
display: flex; |
||||
align-items: center; |
||||
justify-content: center; |
||||
.load-view { |
||||
display: flex; |
||||
align-items: center; |
||||
// .loading-animation { |
||||
// width: 30rpx; |
||||
// height: 30rpx; |
||||
// } |
||||
.loading-text { |
||||
color: #606266; |
||||
font-size: 24rpx; |
||||
margin-left: 20rpx; |
||||
} |
||||
} |
||||
} |
||||
.loading-animation { |
||||
position: relative; |
||||
&::after, |
||||
&::before { |
||||
left: 0; |
||||
width: 100%; |
||||
position: absolute; |
||||
border: 0 solid currentColor; |
||||
background-color: #b7b7b7; |
||||
} |
||||
&::after { |
||||
content: ''; |
||||
top: -25%; |
||||
z-index: 1; |
||||
height: 100%; |
||||
border-radius: 10%; |
||||
animation: spin 0.6s -0.1s linear infinite; |
||||
} |
||||
&::before { |
||||
content: ''; |
||||
bottom: -9%; |
||||
height: 10%; |
||||
background: #000; |
||||
border-radius: 50%; |
||||
opacity: 0.2; |
||||
animation: shadow 0.6s -0.1s linear infinite; |
||||
} |
||||
@keyframes spin { |
||||
17% { |
||||
border-bottom-right-radius: 10%; |
||||
} |
||||
25% { |
||||
transform: translateY(25%) rotate(22.5deg); |
||||
} |
||||
50% { |
||||
border-bottom-right-radius: 100%; |
||||
transform: translateY(50%) scale(1, 0.9) rotate(45deg); |
||||
} |
||||
75% { |
||||
transform: translateY(25%) rotate(67.5deg); |
||||
} |
||||
100% { |
||||
transform: translateY(0) rotate(90deg); |
||||
} |
||||
} |
||||
@keyframes shadow { |
||||
50% { |
||||
transform: scale(1.25, 1); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
</style> |
File diff suppressed because one or more lines are too long
@ -1,350 +0,0 @@ |
||||
<template> |
||||
<view class="container"> |
||||
|
||||
<view class='addAddress'> |
||||
<!-- <view class="pad30"> |
||||
<view class='default acea-row row-middle borderRadius15'> |
||||
<input v-model="addressValue" type="text" placeholder="粘贴地址信息,自动拆分姓名、电话和地址" |
||||
placeholder-class='placeholder' style="width:100%;" |
||||
@blur="identify()"> |
||||
</view> |
||||
</view> --> |
||||
<view class="pad30 mt-22"> |
||||
<view class='list borderRadius15'> |
||||
<uni-forms ref="form" label-position="left" :modelValue="userAddress"> |
||||
<uni-forms-item label="姓名" name="real_name" class='item acea-row row-between-wrapper'> |
||||
|
||||
<input type='text' placeholder='请输入姓名' name='real_name' :value="userAddress.real_name" |
||||
placeholder-class='placeholder' class="width100"></input> |
||||
</uni-forms-item> |
||||
|
||||
<uni-forms-item label="联系电话" name="phone" class='item acea-row row-between-wrapper'> |
||||
|
||||
<input type='number' placeholder='请输入联系电话' name="phone" v-model='userAddress.phone' |
||||
placeholder-class='placeholder' pattern="\d*"></input> |
||||
</uni-forms-item> |
||||
|
||||
<uni-forms-item label="所在地区" name="region" class='item acea-row row-between-wrapper'> |
||||
|
||||
<view class="address acea-row row-between height100" @click="chooseAddress"> |
||||
<input type='text' placeholder='请选择地址' :disabled="true" name='region' placeholder-class='placeholder' |
||||
v-model='userAddress.region' class="detail"></input> |
||||
<view class="icon-ymt to-right font14 fcor666"> |
||||
|
||||
</view> |
||||
</view> |
||||
|
||||
</uni-forms-item> |
||||
|
||||
<uni-forms-item label="详细地址" name="detail" class='item acea-row row-between-wrapper'> |
||||
|
||||
|
||||
<input type='text' placeholder='请填写具体地址' name='detail' placeholder-class='placeholder' |
||||
v-model='userAddress.detail' class="detail"></input> |
||||
|
||||
</uni-forms-item> |
||||
</uni-forms> |
||||
</view> |
||||
</view> |
||||
<button class='keepBnt bg-color' @click="formSubmit">立即保存</button> |
||||
</view> |
||||
|
||||
|
||||
|
||||
<AddressPicker ref="AddressPicker" @getAddress="getAddress"></AddressPicker> |
||||
</view> |
||||
</template> |
||||
<script> |
||||
import uniForms from '@/components/uni-forms/components/uni-forms/uni-forms.vue' |
||||
import uniFormsItem from '@/components/uni-forms/components/uni-forms-item/uni-forms-item.vue' |
||||
|
||||
import AddressPicker from '@/pages/address/addNewAddress/addressPicker.vue' |
||||
let dataList = require('./address.json') |
||||
export default { |
||||
data() { |
||||
return { |
||||
userAddress: { |
||||
real_name:"", |
||||
phone:"", |
||||
region:"", |
||||
detail:"", |
||||
}, //地址详情 |
||||
addressValue:"", |
||||
addressId:null, |
||||
/* rulesObject:{ |
||||
real_name:{ |
||||
rules:[ |
||||
// 校验 name 不能为空 |
||||
{ |
||||
required: true, |
||||
errorMessage: '请填写姓名', |
||||
}, |
||||
// 对name字段进行长度验证 |
||||
{ |
||||
minLength: 2, |
||||
maxLength: 5, |
||||
errorMessage: '{label}长度在 {minLength} 到 {maxLength} 个字符', |
||||
} |
||||
], |
||||
}, |
||||
phone:{ |
||||
rules:[ |
||||
{ |
||||
required: true, |
||||
errorMessage: '请输入手机号', |
||||
}, |
||||
{ |
||||
validateFunction: function(rule, value, data, callback) { |
||||
let iphoneReg = /^1[0-9]{10}$/ |
||||
if (!iphoneReg.test(value)) { |
||||
callback('手机号码格式不正确,请重新填写') |
||||
} |
||||
return true |
||||
} |
||||
} |
||||
|
||||
], |
||||
}, |
||||
region:{ |
||||
rules:[ |
||||
{ |
||||
required: true, |
||||
errorMessage: '请选择地址', |
||||
}, |
||||
|
||||
], |
||||
}, |
||||
detail:{ |
||||
rules:[ |
||||
{ |
||||
required: true, |
||||
errorMessage: '请填写详细地址', |
||||
}, |
||||
{ |
||||
minLength: 5, |
||||
|
||||
errorMessage: '{label}长度不能少于{minLength}个字符', |
||||
} |
||||
|
||||
], |
||||
}, |
||||
|
||||
} |
||||
*/ |
||||
|
||||
} |
||||
}, |
||||
components:{ |
||||
AddressPicker, |
||||
"uni-forms":uniForms, |
||||
"uni-forms-item":uniFormsItem |
||||
// uniForms, |
||||
// uniFormsItem |
||||
}, |
||||
onReady() { |
||||
// 需要在onReady中设置规则 |
||||
// this.$refs.form.setRules(this.rulesObject) |
||||
|
||||
// if(this.addressId){ |
||||
// uni.setNavigationBarTitle({ |
||||
// title: '编辑地址' |
||||
// }); |
||||
// } |
||||
}, |
||||
onLoad(options){ |
||||
|
||||
if(options.id){ |
||||
this.addressId = options.id |
||||
uni.setNavigationBarTitle({ |
||||
title: '编辑地址' |
||||
}); |
||||
|
||||
} |
||||
|
||||
|
||||
|
||||
}, |
||||
|
||||
methods: { |
||||
identify(){ |
||||
const options = { |
||||
type: 0, // 哪种方式解析,0:正则,1:树查找 |
||||
textFilter: [], // 预清洗的字段 |
||||
nameMaxLength: 4, // 查找最大的中文名字长度 |
||||
} |
||||
// type参数0表示使用正则解析,1表示采用树查找, textFilter地址预清洗过滤字段。 |
||||
// if(!!this.addressValue){ |
||||
// const parseResult = AddressParse(this.addressValue, options) |
||||
// // console.log(parseResult); |
||||
// this.userAddress.real_name = parseResult.name; |
||||
// this.userAddress.phone = parseResult.phone; |
||||
// this.userAddress.detail = parseResult.detail; |
||||
// this.userAddress.region = parseResult.province + '/' + parseResult.city + '/' + parseResult.area; |
||||
// } |
||||
}, |
||||
|
||||
formSubmit(form) { |
||||
|
||||
// 暂时不起作用 |
||||
|
||||
// this.$refs.form.validate().then(res => { |
||||
// console.log('success', res); |
||||
// uni.showToast({ |
||||
// title: `校验通过` |
||||
// }) |
||||
// }).catch(err => { |
||||
// console.log('err', err); |
||||
// }) |
||||
|
||||
let _this = this; |
||||
|
||||
this.$refs.form.validate().then(res=>{ |
||||
console.log(_this.userAddress,res) |
||||
}) |
||||
|
||||
}, |
||||
chooseAddress(){ |
||||
this.$refs.AddressPicker.show() |
||||
}, |
||||
getAddress(address){ |
||||
console.log(address,"address") |
||||
this.userAddress.region=address |
||||
} |
||||
|
||||
|
||||
}, |
||||
} |
||||
</script> |
||||
<style lang="scss" scoped> |
||||
.container{ |
||||
background-color: #f5f5f5; |
||||
height: 100vh; |
||||
box-sizing: border-box; |
||||
padding-top:30rpx; |
||||
} |
||||
|
||||
/deep/ .uni-forms-item__label .label-text{ |
||||
font-size: 30rpx !important; |
||||
} |
||||
|
||||
/deep/ .uni-forms-item{ |
||||
width: 100% !important; |
||||
} |
||||
|
||||
.pad30 { |
||||
padding: 0 30rpx |
||||
} |
||||
|
||||
|
||||
|
||||
.acea-row { |
||||
display: flex; |
||||
align-items: center; |
||||
} |
||||
.row-middle { |
||||
align-items: center |
||||
} |
||||
.row-between-wrapper { |
||||
align-items: center; |
||||
justify-content: space-between |
||||
} |
||||
.borderRadius15 { |
||||
border-radius: 15rpx !important; |
||||
} |
||||
|
||||
.addAddress .list { |
||||
background-color: #fff; |
||||
} |
||||
|
||||
.addAddress .list .item { |
||||
padding: 30rpx ; |
||||
padding-bottom: 0; |
||||
border-top: 1rpx solid #eee; |
||||
position: relative; |
||||
} |
||||
|
||||
.addAddress .list .item .detail{ |
||||
// width: 368rpx; |
||||
} |
||||
|
||||
.addAddress .list .item .location{ |
||||
position: absolute; |
||||
right: 46rpx; |
||||
top: 50%; |
||||
margin-top: -40rpx!important; |
||||
font-size: 24rpx; |
||||
text-align: center; |
||||
} |
||||
|
||||
|
||||
|
||||
.addAddress .list .item .name { |
||||
width: 195rpx; |
||||
font-size: 30rpx; |
||||
color: #333; |
||||
} |
||||
|
||||
.addAddress .list .item .address { |
||||
flex: 1; |
||||
} |
||||
|
||||
.addAddress .list .item .address .addressCon{ |
||||
width: 360rpx; |
||||
} |
||||
|
||||
.addAddress .list .item .address .addressCon .tip{ |
||||
font-size: 21rpx; |
||||
margin-top: 4rpx; |
||||
} |
||||
|
||||
.addAddress .list .item input { |
||||
// width: 475rpx; |
||||
flex: 1; |
||||
font-size: 30rpx; |
||||
display: flex; |
||||
flex-direction: column; |
||||
justify-content: center; |
||||
height: 100%; |
||||
} |
||||
|
||||
.placeholder { |
||||
color: #ccc; |
||||
} |
||||
|
||||
.addAddress .list .item .picker { |
||||
width: 430rpx; |
||||
font-size: 30rpx; |
||||
} |
||||
|
||||
|
||||
|
||||
.addAddress .default { |
||||
padding: 0 30rpx; |
||||
height: 90rpx; |
||||
background-color: #fff; |
||||
} |
||||
|
||||
|
||||
|
||||
.addAddress .keepBnt { |
||||
width: 690rpx; |
||||
height: 86rpx; |
||||
border-radius: 50rpx; |
||||
text-align: center; |
||||
line-height: 86rpx; |
||||
margin: 50rpx auto; |
||||
font-size: 32rpx; |
||||
color: #fff; |
||||
} |
||||
|
||||
|
||||
.mt-22{ |
||||
margin-top: 22rpx; |
||||
} |
||||
.bg-color { |
||||
background-color: #dd524d; |
||||
} |
||||
|
||||
|
||||
|
||||
</style> |
@ -1,46 +0,0 @@ |
||||
|
||||
{ |
||||
"id": "2", |
||||
"realstore_id": "0", |
||||
"realstore_goods_id": "0", |
||||
"shop_id": "1", |
||||
"shop_user_id": "1", |
||||
"shop_category_id": "1", |
||||
"shop_settle_price": "0.00", |
||||
"shop_settle_rate": "0.00", |
||||
"brand_id": "2", |
||||
"site_type": "-1", |
||||
"title": "苹果(Apple)iPhone 6 Plus (A1524)移动联通电信4G手机 金色 16G", |
||||
"title_color": "", |
||||
"simple_desc": "1.芯片功能强大 iPhone芯片的更新频率比友商少,但每次iPhone芯片更新时,都会成为关注和追赶的对象。", |
||||
"model": "iPhone 6 Plus", |
||||
"place_origin": "0", |
||||
"inventory": "7983", |
||||
"inventory_unit": "步", |
||||
"images": ["https://gw.alicdn.com/bao/uploaded/i2/708446530/O1CN01WZY06s1y6mybMkFwh_!!708446530.jpg_300x300q90.jpg_.webp","https://d1.shopxo.vip/static/upload/images/goods/2019/01/14/1547451274847894.jpg"], |
||||
"original_price": "4500.00-6800.00", |
||||
"min_original_price": "4500.00", |
||||
"max_original_price": "6800.00", |
||||
"price": "4500.00-6800.00", |
||||
"min_price": "4500.00", |
||||
"max_price": "6800.00", |
||||
"give_integral": "30", |
||||
"buy_min_number": "1", |
||||
"buy_max_number": "0", |
||||
"is_deduction_inventory": "1", |
||||
"is_shelves": "1", |
||||
"content_web": "<p style=\"margin:0;\"><a href=\"https://store.shopxo.net/\" target=\"_blank\" title=\"进入指定页面>>\">进入指定页面>></a></p><p style=\"margin:0;\"><video class=\"edui-faked-video video-js\" controls=\"\" preload=\"none\" width=\"420\" height=\"280\" src=\"https://d1.shopxo.vip/static/upload/video/goods/2019/01/14/1547458876723311.mp4\" data-setup=\"{}\"></video></p><p style=\"margin:0;\"><a href=\"https://shopxo.net/?q=test&u=hello你好!\" target=\"_blank\" title=\"打开一个a标签地址\"><strong><span style=\"font-size: 24px; color: rgb(255, 0, 0);\">打开一个a标签地址</span></strong></a><br/></p><p style=\"margin:0;\"><a href=\"/pages/plugins/blog/index/index\" target=\"_self\" title=\"进入博客页面\">进入博客</a></p><p style=\"margin:0;\"><img style=\"max-width:100%;height:auto;margin:0;padding:0;display:block;\" src=\"https://d1.shopxo.vip/static/upload/images/goods/2019/01/14/1547451595700972.jpg\" title=\"1547451595700972.jpg\"/></p><p style=\"margin:0;\"><img style=\"max-width:100%;height:auto;margin:0;padding:0;display:block;\" src=\"https://d1.shopxo.vip/static/upload/images/goods/2019/01/14/1547451595528800.jpg\" title=\"1547451595528800.jpg\"/></p><p style=\"margin:0;\"><img style=\"max-width:100%;height:auto;margin:0;padding:0;display:block;\" src=\"https://d1.shopxo.vip/static/upload/images/goods/2019/01/14/1547451595616298.jpg\" title=\"1547451595616298.jpg\"/></p><p style=\"margin:0;\"><br/></p>", |
||||
"photo_count": "2", |
||||
"sales_count": "266", |
||||
"access_count": "13333", |
||||
"is_exist_many_spec": "1", |
||||
"spec_base": "", |
||||
"plugins_membershiplevelvip_price_extends": "", |
||||
"seo_title": "", |
||||
"seo_keywords": "", |
||||
"seo_desc": "", |
||||
"is_delete_time": "0", |
||||
"add_time": "2019-01-14 15:40:24", |
||||
"upd_time": "2023-03-24 17:46:26" |
||||
|
||||
} |
File diff suppressed because one or more lines are too long
@ -1,46 +0,0 @@ |
||||
|
||||
{ |
||||
"id": "2", |
||||
"realstore_id": "0", |
||||
"realstore_goods_id": "0", |
||||
"shop_id": "1", |
||||
"shop_user_id": "1", |
||||
"shop_category_id": "1", |
||||
"shop_settle_price": "0.00", |
||||
"shop_settle_rate": "0.00", |
||||
"brand_id": "2", |
||||
"site_type": "-1", |
||||
"title": "苹果(Apple)iPhone 6 Plus (A1524)移动联通电信4G手机 金色 16G", |
||||
"title_color": "", |
||||
"simple_desc": "1.芯片功能强大 iPhone芯片的更新频率比友商少,但每次iPhone芯片更新时,都会成为关注和追赶的对象。", |
||||
"model": "iPhone 6 Plus", |
||||
"place_origin": "0", |
||||
"inventory": "7983", |
||||
"inventory_unit": "步", |
||||
"images": ["https://gw.alicdn.com/bao/uploaded/i2/2200817857369/O1CN013I5Mae24J3O6w9wOE_!!2-item_pic.png_300x300q90.jpg_.webp","https://d1.shopxo.vip/static/upload/images/goods/2019/01/14/1547451274847894.jpg"], |
||||
"original_price": "4500.00-6800.00", |
||||
"min_original_price": "4500.00", |
||||
"max_original_price": "6800.00", |
||||
"price": "4500.00-6800.00", |
||||
"min_price": "4500.00", |
||||
"max_price": "6800.00", |
||||
"give_integral": "30", |
||||
"buy_min_number": "1", |
||||
"buy_max_number": "0", |
||||
"is_deduction_inventory": "1", |
||||
"is_shelves": "1", |
||||
"content_web": "<p style=\"margin:0;\"><a href=\"https://store.shopxo.net/\" target=\"_blank\" title=\"进入指定页面>>\">进入指定页面>></a></p><p style=\"margin:0;\"><video class=\"edui-faked-video video-js\" controls=\"\" preload=\"none\" width=\"420\" height=\"280\" src=\"https://d1.shopxo.vip/static/upload/video/goods/2019/01/14/1547458876723311.mp4\" data-setup=\"{}\"></video></p><p style=\"margin:0;\"><a href=\"https://shopxo.net/?q=test&u=hello你好!\" target=\"_blank\" title=\"打开一个a标签地址\"><strong><span style=\"font-size: 24px; color: rgb(255, 0, 0);\">打开一个a标签地址</span></strong></a><br/></p><p style=\"margin:0;\"><a href=\"/pages/plugins/blog/index/index\" target=\"_self\" title=\"进入博客页面\">进入博客</a></p><p style=\"margin:0;\"><img style=\"max-width:100%;height:auto;margin:0;padding:0;display:block;\" src=\"https://d1.shopxo.vip/static/upload/images/goods/2019/01/14/1547451595700972.jpg\" title=\"1547451595700972.jpg\"/></p><p style=\"margin:0;\"><img style=\"max-width:100%;height:auto;margin:0;padding:0;display:block;\" src=\"https://d1.shopxo.vip/static/upload/images/goods/2019/01/14/1547451595528800.jpg\" title=\"1547451595528800.jpg\"/></p><p style=\"margin:0;\"><img style=\"max-width:100%;height:auto;margin:0;padding:0;display:block;\" src=\"https://d1.shopxo.vip/static/upload/images/goods/2019/01/14/1547451595616298.jpg\" title=\"1547451595616298.jpg\"/></p><p style=\"margin:0;\"><br/></p>", |
||||
"photo_count": "2", |
||||
"sales_count": "266", |
||||
"access_count": "13333", |
||||
"is_exist_many_spec": "1", |
||||
"spec_base": "", |
||||
"plugins_membershiplevelvip_price_extends": "", |
||||
"seo_title": "", |
||||
"seo_keywords": "", |
||||
"seo_desc": "", |
||||
"is_delete_time": "0", |
||||
"add_time": "2019-01-14 15:40:24", |
||||
"upd_time": "2023-03-24 17:46:26" |
||||
|
||||
} |
Loading…
Reference in new issue