address api
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user