address api
This commit is contained in:
parent
fe995ced2d
commit
8c993da2cd
@ -78,10 +78,75 @@ export default {
|
||||
pid: pid
|
||||
});
|
||||
},
|
||||
getArea() {
|
||||
return vm.$u.post('Area/getAreaTree')
|
||||
},
|
||||
// 用户收货地址列表
|
||||
getAddressList() {
|
||||
return vm.$u.post('MemberAddress/addressList');
|
||||
},
|
||||
// 添加收货地址
|
||||
addressAdd({
|
||||
area_id,
|
||||
city_id,
|
||||
is_default,
|
||||
area_info,
|
||||
address,
|
||||
true_name,
|
||||
mobile_phone,
|
||||
// longitude,
|
||||
// latitude,
|
||||
}) {
|
||||
return vm.$u.post('memberAddress/addressAdd', {
|
||||
area_id: area_id,
|
||||
city_id: city_id,
|
||||
is_default: is_default,
|
||||
area_info: area_info,
|
||||
address: address,
|
||||
true_name: true_name,
|
||||
mobile_phone: mobile_phone,
|
||||
// longitude: longitude,
|
||||
// latitude: latitude,
|
||||
});
|
||||
},
|
||||
// 修改收货地址
|
||||
addressEdit({
|
||||
address_id,
|
||||
area_id,
|
||||
city_id,
|
||||
is_default,
|
||||
area_info,
|
||||
address,
|
||||
true_name,
|
||||
mobile_phone,
|
||||
// longitude,
|
||||
// latitude,
|
||||
}) {
|
||||
return vm.$u.post('memberAddress/addressEdit', {
|
||||
address_id: address_id,
|
||||
area_id: area_id,
|
||||
city_id: city_id,
|
||||
is_default: is_default,
|
||||
area_info: area_info,
|
||||
address: address,
|
||||
true_name: true_name,
|
||||
mobile_phone: mobile_phone,
|
||||
// longitude: longitude,
|
||||
// latitude: latitude,
|
||||
});
|
||||
},
|
||||
// 删除地址
|
||||
deleteAddress({ address_id }) {
|
||||
return vm.$u.post('memberAddress/addressDel', {
|
||||
address_id: address_id
|
||||
});
|
||||
},
|
||||
// 设默认地址
|
||||
setDefaultAddress({ address_id }) {
|
||||
return vm.$u.post('memberAddress/addressSetDefault', {
|
||||
address_id: address_id
|
||||
});
|
||||
},
|
||||
// 美甲
|
||||
getManicureList({ page }) {
|
||||
return vm.$u.post('MemberManicure/getManicureList', {
|
||||
@ -95,6 +160,10 @@ export default {
|
||||
time: time
|
||||
});
|
||||
},
|
||||
// 会员服务-积分列表
|
||||
getPointslogList() {
|
||||
return vm.$u.post('member/pointslogList');
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
@ -2,16 +2,20 @@
|
||||
<view class="address-active">
|
||||
<view class="user-info">
|
||||
<view>
|
||||
<input type="text" placeholder="收货人" />
|
||||
<input type="text" placeholder="收货人" v-model="name" />
|
||||
</view>
|
||||
<view>
|
||||
<input type="text" placeholder="手机号" />
|
||||
<input type="text" placeholder="手机号" maxlength="11" v-model="phone" />
|
||||
</view>
|
||||
<view class="area" @click="show=true">
|
||||
<input type="text" placeholder="省市区" disabled />
|
||||
<input type="text" placeholder="省市区" v-model="address" disabled />
|
||||
<view>
|
||||
<image src="/static/image/mine/24.png"></image>
|
||||
<text>定位</text>
|
||||
</view>
|
||||
</view>
|
||||
<view>
|
||||
<input type="text" placeholder="详细地址" />
|
||||
<input type="text" placeholder="详细地址" v-model="area" />
|
||||
</view>
|
||||
<view class="set-default">
|
||||
<view>设为默认地址</view>
|
||||
@ -20,34 +24,158 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="edit-btn">保存地址</view>
|
||||
<!-- <u-picker mode="region" v-model="show" @confirm="setArea"></u-picker> -->
|
||||
<u-select v-model="show" mode="mutil-column-auto" :list="areaList" @confirm="setArea"></u-select>
|
||||
<view class="edit-btn" @click="confirmBtn">保存地址</view>
|
||||
<u-select v-model="show"
|
||||
mode="mutil-column-auto"
|
||||
:list="areaList"
|
||||
value-name="area_id"
|
||||
label-name="area_name"
|
||||
child-name="_child"
|
||||
@confirm="setArea">
|
||||
</u-select>
|
||||
<u-toast ref="uToast" />
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
checked: false,
|
||||
show: false,
|
||||
areaList: []
|
||||
areaList: [],
|
||||
checked: false, // 是否设为默认地址
|
||||
name: '',
|
||||
phone: '',
|
||||
address: '', // 选择地址
|
||||
area: '', // 详细地址
|
||||
area_id: '', // 地区id 省
|
||||
city_id: '', // 城市id
|
||||
}
|
||||
},
|
||||
props: {
|
||||
info: Object
|
||||
},
|
||||
mounted() {
|
||||
this.getAreaList(0);
|
||||
this.getAreaData();
|
||||
},
|
||||
created() {
|
||||
// console.log(this.info);
|
||||
this.initAddressInfo();
|
||||
},
|
||||
methods: {
|
||||
setArea(e) {
|
||||
console.log(e);
|
||||
// 判断是不是编辑页面 数据初始化
|
||||
initAddressInfo() {
|
||||
if(JSON.stringify(this.info) != '{}') {
|
||||
[this.name, this.phone, this.address, this.area, this.area_id, this.city_id] = [
|
||||
this.info.address_realname,
|
||||
this.info.address_mob_phone,
|
||||
this.info.area_info,
|
||||
this.info.address_detail,
|
||||
this.info.area_id,
|
||||
this.info.city_id
|
||||
]
|
||||
this.checked = this.info.address_is_default == '0' ? false : true;
|
||||
}
|
||||
},
|
||||
getAreaList(pid) {
|
||||
this.$u.api.getAreaList({
|
||||
pid: pid
|
||||
// 判断是不是编辑页面 调用接口
|
||||
confirmBtn() {
|
||||
JSON.stringify(this.info) != '{}' ? this.editAddress() : this.addAddress();
|
||||
},
|
||||
// 验证
|
||||
validateValue() {
|
||||
if(this.$u.test.isEmpty(this.name)) {
|
||||
this.showToast('姓名不能为空', 'warning');
|
||||
return false;
|
||||
}
|
||||
if(this.$u.test.isEmpty(this.phone)) {
|
||||
this.showToast('手机号不能为空', 'warning');
|
||||
return false;
|
||||
}
|
||||
if(!this.$u.test.mobile(this.phone)) {
|
||||
this.showToast('手机号错误', 'warning');
|
||||
return false;
|
||||
}
|
||||
if(this.$u.test.isEmpty(this.address)) {
|
||||
this.showToast('地址不能为空', 'warning');
|
||||
return false;
|
||||
}
|
||||
if(this.$u.test.isEmpty(this.area)) {
|
||||
this.showToast('详细地址不能为空', 'warning');
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
},
|
||||
addAddress() {
|
||||
if(!this.validateValue()) return false;
|
||||
this.$u.api.addressAdd({
|
||||
area_id: this.area_id,
|
||||
city_id: this.city_id,
|
||||
is_default: this.checked ? 1 : 0,
|
||||
area_info: this.address,
|
||||
address: this.area,
|
||||
true_name: this.name,
|
||||
mobile_phone: this.phone,
|
||||
// longitude,
|
||||
// latitude,
|
||||
}).then((res)=>{
|
||||
if (res.errCode == 0) {}
|
||||
if (res.errCode == 0) {
|
||||
this.$refs.uToast.show({
|
||||
title: res.message,
|
||||
type: 'success',
|
||||
url: '/pageE/more/Address'
|
||||
})
|
||||
} else {
|
||||
this.showToast(res.message, 'warning');
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
editAddress() {
|
||||
if(!this.validateValue()) return false;
|
||||
this.$u.api.addressEdit({
|
||||
address_id: this.info.address_id,
|
||||
area_id: this.area_id,
|
||||
city_id: this.city_id,
|
||||
is_default: this.checked ? 1 : 0,
|
||||
area_info: this.address,
|
||||
address: this.area,
|
||||
true_name: this.name,
|
||||
mobile_phone: this.phone,
|
||||
// longitude,
|
||||
// latitude,
|
||||
}).then((res)=>{
|
||||
if (res.errCode == 0) {
|
||||
this.$refs.uToast.show({
|
||||
title: res.message,
|
||||
type: 'success',
|
||||
url: '/pageE/more/Address'
|
||||
})
|
||||
} else {
|
||||
this.showToast(res.message, 'warning');
|
||||
}
|
||||
})
|
||||
},
|
||||
getAreaData() {
|
||||
this.$u.api.getArea().then((res)=>{
|
||||
if (res.errCode == 0) {
|
||||
this.areaList = res.data;
|
||||
}
|
||||
})
|
||||
},
|
||||
setArea(area) {
|
||||
// console.log(area);
|
||||
this.area_id = area[0].value;
|
||||
this.city_id = area[1].value;
|
||||
let temp = '';
|
||||
area.forEach(e => {
|
||||
temp += e.label;
|
||||
});
|
||||
this.address = temp;
|
||||
},
|
||||
showToast(message, type) {
|
||||
this.$refs.uToast.show({
|
||||
title: message,
|
||||
type: type,
|
||||
})
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
@ -71,6 +199,29 @@ export default {
|
||||
font-size: 30rpx;
|
||||
color: rgba(51,51,51,1);
|
||||
}
|
||||
.area {
|
||||
padding: 0 30rpx;
|
||||
display: flex;
|
||||
> input {
|
||||
padding: 30rpx 0;
|
||||
flex: 1;
|
||||
}
|
||||
> view {
|
||||
margin-left: 30rpx;
|
||||
width: 50rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 22rpx;
|
||||
color: rgba(255,120,15,1);
|
||||
> image {
|
||||
width: 26rpx;
|
||||
height: 32rpx;
|
||||
margin-bottom: 10rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.edit-btn {
|
||||
margin: 122rpx auto 0;
|
||||
|
@ -3,7 +3,7 @@
|
||||
<view class="item-top">
|
||||
<view class="user-info">
|
||||
<view class="user-name">{{ item.address_realname }}</view>
|
||||
<view class="user-pnone">{{ item.address_tel_phone }}</view>
|
||||
<view class="user-pnone">{{ item.address_mob_phone | phoneFormat }}</view>
|
||||
</view>
|
||||
<view class="user-address u-line-2">{{ $u.trim(item.area_info + item.address_detail, 'all') }}</view>
|
||||
</view>
|
||||
@ -13,6 +13,7 @@
|
||||
:name="item.address_id"
|
||||
shape="circle"
|
||||
label-size="22"
|
||||
:disabled="false"
|
||||
>
|
||||
<view :class="[item.address_is_default == '0' ? 'radio-others' : 'radio-default']">
|
||||
{{ item.address_is_default == '0' ? '设为默认' : '已设为默认' }}
|
||||
@ -24,11 +25,12 @@
|
||||
<image src="@/pageE/static/mine/24.png"></image>
|
||||
<view>编辑</view>
|
||||
</view>
|
||||
<view>
|
||||
<view @click="deleteAddress">
|
||||
<image src="@/pageE/static/mine/25.png"></image>
|
||||
<view>删除</view>
|
||||
</view>
|
||||
</view>
|
||||
<u-toast ref="uToast" />
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
@ -42,13 +44,40 @@ export default {
|
||||
},
|
||||
props: ['item', 'current'],
|
||||
mounted() {
|
||||
console.log(this.item);
|
||||
// console.log(this.item);
|
||||
},
|
||||
filters: {
|
||||
phoneFormat(value) {
|
||||
return value.replace(/^(\d{3})\d*(\d{4})$/, '$1****$2');
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
editAddress() {
|
||||
uni.navigateTo({
|
||||
url: '/pageE/more/EditAddress'
|
||||
});
|
||||
this.$u.route({
|
||||
url: '/pageE/more/EditAddress',
|
||||
params: {
|
||||
item: JSON.stringify(this.item)
|
||||
}
|
||||
})
|
||||
},
|
||||
deleteAddress() {
|
||||
// console.log(this.item.address_id);
|
||||
this.$u.api.deleteAddress({
|
||||
address_id: this.item.address_id
|
||||
}).then((res)=>{
|
||||
if(res.errCode == 0) {
|
||||
this.showToast(res.message, 'success');
|
||||
this.$emit('getAddressList');
|
||||
} else {
|
||||
this.showToast(res.message, 'warning');
|
||||
}
|
||||
})
|
||||
},
|
||||
showToast(message, type) {
|
||||
this.$refs.uToast.show({
|
||||
title: message,
|
||||
type: type,
|
||||
})
|
||||
},
|
||||
},
|
||||
}
|
||||
|
6
package-lock.json
generated
6
package-lock.json
generated
@ -5,9 +5,9 @@
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
"uview-ui": {
|
||||
"version": "1.2.9",
|
||||
"resolved": "https://registry.npm.taobao.org/uview-ui/download/uview-ui-1.2.9.tgz",
|
||||
"integrity": "sha1-PwC6ziaB/LXyMacGRkMfPrZfF2c="
|
||||
"version": "1.3.68",
|
||||
"resolved": "https://registry.npmjs.org/uview-ui/-/uview-ui-1.3.68.tgz",
|
||||
"integrity": "sha512-fwszoohFC1HLvIqwwnXPRytT52qGy0viGEzyJtVwemNBAu5z6Ddjwe9ORqsrlQQo7PSvHdyCNHWrSLGzoyKKoQ=="
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -13,6 +13,6 @@
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"uview-ui": "^1.2.9"
|
||||
"uview-ui": "^1.3.68"
|
||||
}
|
||||
}
|
||||
|
@ -43,13 +43,13 @@
|
||||
</swiper-item>
|
||||
<swiper-item class="swiper-item">
|
||||
<scroll-view scroll-y class="details">
|
||||
<view v-for="(item, index) in 16" :key="index" class="details-item">
|
||||
<view v-for="(item, index) in pointslogList" :key="index" class="details-item">
|
||||
<view class="item-left">
|
||||
<view class="item-title">积分商城兑换礼品</view>
|
||||
<view class="item-date">2020-03-11</view>
|
||||
<view class="item-title">{{ item.pl_desc }}</view>
|
||||
<view class="item-date">{{ item.pl_addtime }}</view>
|
||||
</view>
|
||||
<view class="item-right" :class="[index&1 ? 'negative' : 'positive']">
|
||||
{{ index&1 ? '-' + 10.00 : '+' + 10.00 }}
|
||||
<view class="item-right" :class="[item.pl_addtime < 0 ? 'negative' : 'positive']">
|
||||
{{ item.pl_addtime > 0 ? item.pl_addtime : '+' + 10.00 }}
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
@ -70,9 +70,13 @@ export default {
|
||||
}],
|
||||
current: 0,
|
||||
swiperCurrent: 0,
|
||||
nodes: '<h1>2</h1><h1>2</h1><h1>2</h1><h1>2</h1><h1>2</h1><h1>2</h1><h1>2</h1><h1>2</h1><h1>2</h1><h1>2</h1><h1>2</h1><h1>2</h1><h1>2</h1><h1>2</h1><h1>2</h1><h1>2</h1><h1>2</h1><h1>2</h1>'
|
||||
nodes: '<h1>2</h1><h1>2</h1><h1>2</h1><h1>2</h1><h1>2</h1><h1>2</h1><h1>2</h1><h1>2</h1><h1>2</h1><h1>2</h1><h1>2</h1><h1>2</h1><h1>2</h1><h1>2</h1><h1>2</h1><h1>2</h1><h1>2</h1><h1>2</h1>',
|
||||
pointslogList: []
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
this.getPointslogList();
|
||||
},
|
||||
methods: {
|
||||
tabsChange(index) {
|
||||
this.swiperCurrent = index;
|
||||
@ -81,6 +85,13 @@ export default {
|
||||
let current = e.detail.current;
|
||||
this.swiperCurrent = current;
|
||||
this.current = current;
|
||||
},
|
||||
getPointslogList() {
|
||||
this.$u.api.getPointslogList().then((res)=>{
|
||||
if (res.errCode == 0) {
|
||||
this.pointslogList = res.data;
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
}
|
||||
|
@ -17,7 +17,6 @@ export default {
|
||||
onLoad() {
|
||||
},
|
||||
methods: {
|
||||
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
@ -2,10 +2,11 @@
|
||||
<view class="address">
|
||||
<u-radio-group v-model="current" @change="changeDefault" size="29" active-color="#FF780F">
|
||||
<view v-for="(item, index) in addressList" :key="index" class="address-item">
|
||||
<AddressItem :item="item" :current='current'></AddressItem>
|
||||
<AddressItem :item="item" :current='current' @getAddressList="getAddressList"></AddressItem>
|
||||
</view>
|
||||
</u-radio-group>
|
||||
<view class="address-btn" @click="addAddress">添加地址</view>
|
||||
<u-toast ref="uToast" />
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
@ -13,7 +14,7 @@ import AddressItem from '@/components/mine/address-block/address-item'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
current: 0,
|
||||
current: -1,
|
||||
addressList: []
|
||||
}
|
||||
},
|
||||
@ -31,7 +32,7 @@ export default {
|
||||
let defaultAddress = this.addressList.filter(item => {
|
||||
return item.address_is_default == '1';
|
||||
})
|
||||
this.current = defaultAddress[0].address_id;
|
||||
if(defaultAddress[0]) this.current = defaultAddress[0].address_id;
|
||||
}
|
||||
})
|
||||
},
|
||||
@ -40,9 +41,21 @@ export default {
|
||||
url: '/pageE/more/AddAddress'
|
||||
});
|
||||
},
|
||||
changeDefault(event) {
|
||||
console.log(event)
|
||||
// this.current = event
|
||||
// 设置默认地址
|
||||
changeDefault(id) {
|
||||
// console.log(id)
|
||||
this.$u.api.setDefaultAddress({
|
||||
address_id: id
|
||||
}).then((res)=>{
|
||||
if(res.errCode == 0) {
|
||||
this.getAddressList();
|
||||
} else {
|
||||
this.$refs.uToast.show({
|
||||
title: res.message,
|
||||
type: 'warning',
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -62,7 +75,7 @@ export default {
|
||||
}
|
||||
}
|
||||
.address-btn {
|
||||
margin: 322rpx auto 0;
|
||||
margin: 260rpx auto 0;
|
||||
width: 690rpx;
|
||||
height: 98rpx;
|
||||
background: rgba(255,119,15,1);
|
||||
|
@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<view class="edit-address">
|
||||
<AddressActive></AddressActive>
|
||||
<AddressActive :info="address"></AddressActive>
|
||||
<u-popup v-model="popupShow" mode="center" border-radius="10">
|
||||
<view class="popup-tips">确定要删除该地址吗</view>
|
||||
<view class="popup-btn">
|
||||
@ -8,6 +8,7 @@
|
||||
<view class="determine" @click="delAddress">确定</view>
|
||||
</view>
|
||||
</u-popup>
|
||||
<u-toast ref="uToast" />
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
@ -15,20 +16,44 @@ import AddressActive from '@/components/mine/address-active/index'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
address: {},
|
||||
popupShow: false
|
||||
}
|
||||
},
|
||||
components: {
|
||||
AddressActive
|
||||
},
|
||||
onLoad() {},
|
||||
onLoad(option) {
|
||||
// console.log(JSON.parse(option.item));
|
||||
this.address = JSON.parse(option.item);
|
||||
},
|
||||
onNavigationBarButtonTap() {
|
||||
this.popupShow = true
|
||||
},
|
||||
methods: {
|
||||
delAddress() {
|
||||
this.popupShow = false
|
||||
}
|
||||
this.deleteAddress().then(() => {
|
||||
this.popupShow = false
|
||||
})
|
||||
},
|
||||
async deleteAddress() {
|
||||
this.$u.api.deleteAddress({
|
||||
address_id: this.address.address_id
|
||||
}).then((res)=>{
|
||||
if(res.errCode == 0) {
|
||||
this.$refs.uToast.show({
|
||||
title: res.message,
|
||||
type: 'success',
|
||||
url: '/pageE/more/Address'
|
||||
})
|
||||
} else {
|
||||
this.$refs.uToast.show({
|
||||
title: res.message,
|
||||
type: 'warning'
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
@ -10,10 +10,10 @@
|
||||
<view v-for="(item, index) in orderList" :key="index" class="order-item">
|
||||
<view class="order-title">
|
||||
<view class="order-text">订单</view>
|
||||
<view class="order-status">已预约</view>
|
||||
<view class="order-status">{{ item.status }}</view>
|
||||
</view>
|
||||
<view class="order-name">美甲人姓名:xxx</view>
|
||||
<view class="order-date">时间:2020-04-12</view>
|
||||
<view class="order-name">美甲人姓名:{{ item.manicure_name }}</view>
|
||||
<view class="order-date">时间:{{ item.manicure_time | dateFormat }}</view>
|
||||
</view>
|
||||
<u-loadmore :status="loadStatus" bgColor="#ECECEC" margin-bottom="20"></u-loadmore>
|
||||
</view>
|
||||
@ -39,20 +39,33 @@ export default {
|
||||
current: 0,
|
||||
swiperCurrent: 0,
|
||||
page: 1,
|
||||
orderList: 5,
|
||||
orderList: [],
|
||||
loadStatus: 'loadmore',
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
this.current = 0;
|
||||
this.swiperCurrent = 0;
|
||||
this.getManicureList();
|
||||
},
|
||||
filters: {
|
||||
dateFormat(value) {
|
||||
let date = new Date(value * 1000);
|
||||
let year, month, day;
|
||||
year = date.getFullYear();
|
||||
month = date.getMonth() + 1;
|
||||
day = date.getDate();
|
||||
return year + "-" + month + "-" + day;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getManicureList() {
|
||||
this.$u.api.getManicureList({
|
||||
page: this.page
|
||||
}).then((res)=>{
|
||||
if (res.errCode == 0) {}
|
||||
if (res.errCode == 0) {
|
||||
this.orderList = res.data.list;
|
||||
}
|
||||
})
|
||||
},
|
||||
reachBottom() {
|
||||
|
@ -11,8 +11,9 @@
|
||||
<view v-else>{{ time }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="order-btn">确认订单</view>
|
||||
<view class="order-btn" @click="addManicureOrder">确认订单</view>
|
||||
<u-picker mode="time" v-model="show" :params="params" @confirm="chooseDate"></u-picker>
|
||||
<u-toast ref="uToast" />
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
@ -33,18 +34,42 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
validateValue() {
|
||||
if(this.$u.test.isEmpty(this.name)) {
|
||||
this.showToast('姓名不能为空', 'warning');
|
||||
return false;
|
||||
}
|
||||
if(this.$u.test.isEmpty(this.time)) {
|
||||
this.showToast('日期不能为空', 'warning');
|
||||
return false;
|
||||
}
|
||||
if(new Date() > new Date(this.time)) {
|
||||
this.showToast('日期错误', 'warning');
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
},
|
||||
addManicureOrder() {
|
||||
if(!this.validateValue()) return false;
|
||||
this.$u.api.addManicure({
|
||||
name: this.name,
|
||||
time: this.time
|
||||
time: new Date(this.time)
|
||||
}).then((res)=>{
|
||||
if (res.errCode == 0) {}
|
||||
let type = res.errCode == 0 ? 'success' : 'error';
|
||||
this.showToast(res.message, type);
|
||||
})
|
||||
},
|
||||
chooseDate(e) {
|
||||
let time = e.year + '年' + e.month + '月' + e.day + '日' + e.hour + '时' + e.minute + '分'
|
||||
// let time = e.year + '年' + e.month + '月' + e.day + '日' + e.hour + '时' + e.minute + '分'
|
||||
let time = e.year + '-' + e.month + '-' + e.day + ' ' + e.hour + ':' + e.minute
|
||||
this.time = time
|
||||
}
|
||||
},
|
||||
showToast(message, type) {
|
||||
this.$refs.uToast.show({
|
||||
title: message,
|
||||
type: type,
|
||||
})
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
BIN
static/image/mine/24.png
Normal file
BIN
static/image/mine/24.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.3 KiB |
Loading…
Reference in New Issue
Block a user