Browse Source

新增地址

master
tianyi 1 month ago
parent
commit
e4a4c02782
  1. 8
      package1/address/addAddress.vue
  2. 40
      package1/address/addressList.vue
  3. 198
      package1/runErrand/runErrand.vue

8
package1/address/addAddress.vue

@ -0,0 +1,8 @@
<template>
</template>
<script>
</script>
<style>
</style>

40
package1/address/addressList.vue

@ -0,0 +1,40 @@
<template>
<view class="address-box">
<view>收货地址</view>
<view class="box1" style="display: flex;padding: 20px;">
<view style="flex: 1;">
<view style="height: 21px;line-height: 21px;display: flex;">
<text style="font-size: 15px;font-weight: 700;">沁园春第三食堂A20窗口</text>
</view>
<view style="text-align: right;margin-left: 30px;color: #777;width: 73px;">
刘柳柳 18827381928
</view>
</view>
<view style="width: 18px;padding-top: 10px;">
编辑
</view>
</view>
<view class="">
新增地址
</view>
</view>
</template>
<script>
export default {
data() {
return {
selected: 'phone'
}
},
methods: {
openAddressBook(){
this.$refs.bookPopup.open('bottom')
}
}
}
</script>
<style>
</style>

198
package1/runErrand/runErrand.vue

@ -43,7 +43,7 @@
<view class="dizhi-ming">
沁园春第三食堂A20窗口
</view>
<view class="dizhi-btn">
<view class="dizhi-btn" @tap="openAddressBook">
地址簿
</view>
</view>
@ -57,7 +57,7 @@
<view class="dizhi-ming">
沁园春第三食堂A20窗口
</view>
<view class="dizhi-btn">
<view class="dizhi-btn" @tap="openAddressBook">
地址簿
</view>
</view>
@ -142,72 +142,30 @@
</view>
<view class="content-box">
<view class="content-title">
取件重量<text>*</text>
特殊情况<text>*</text>
</view>
<view style="flex: 1;">
<view class="duoxuan" @tap="checkWeightOrVolume('weight','5公斤以内')"
:style="{'background':addFormData.weight == '5公斤以内' ?'rgba(166, 255, 234, 1)':'#eee'}">
5公斤以内
</view>
<view class="duoxuan" @tap="checkWeightOrVolume('weight','5-10公斤')"
:style="{'background':addFormData.weight == '5-10公斤' ?'rgba(166, 255, 234, 1)':'#eee'}">
5-10公斤
</view>
<view class="duoxuan" @tap="checkWeightOrVolume('weight','10-15公斤')"
:style="{'background':addFormData.weight == '10-15公斤' ?'rgba(166, 255, 234, 1)':'#eee'}">
10-15公斤
</view>
<view class="duoxuan" @tap="checkWeightOrVolume('weight','15-20公斤')"
:style="{'background':addFormData.weight == '15-20公斤' ?'rgba(166, 255, 234, 1)':'#eee'}">
15-20公斤
</view>
<view class="duoxuan" @tap="checkWeightOrVolume('weight','20公斤以上')"
:style="{'background':addFormData.weight == '20公斤以上' ?'rgba(166, 255, 234, 1)':'#eee'}">
20公斤以上
</view>
</view>
</view>
<view class="content-box">
<view class="content-title">
物品体积<text>*</text>
</view>
<view style="flex: 1;">
<view class="duoxuan" @tap="checkWeightOrVolume('volume','0.5立方米以下')"
:style="{'background':addFormData.volume == '0.5立方米以下' ?'rgba(166, 255, 234, 1)':'#eee'}">
0.5立方米以下
</view>
<view class="duoxuan" @tap="checkWeightOrVolume('volume','0.5-1立方米')"
:style="{'background':addFormData.volume == '0.5-1立方米' ?'rgba(166, 255, 234, 1)':'#eee'}">
0.5-1立方米
</view>
<view class="duoxuan" @tap="checkWeightOrVolume('volume','1.1-1.5立方米')"
:style="{'background':addFormData.volume == '1.1-1.5立方米' ?'rgba(166, 255, 234, 1)':'#eee'}">
1.1-1.5立方米
</view>
<view class="duoxuan" @tap="checkWeightOrVolume('volume','1.6-2立方米')"
:style="{'background':addFormData.volume == '1.6-2立方米' ?'rgba(166, 255, 234, 1)':'#eee'}">
1.6-2立方米
</view>
<view class="duoxuan" @tap="checkWeightOrVolume('volume','2.1立方米以上')"
:style="{'background':addFormData.volume == '2.1立方米以上' ?'rgba(166, 255, 234, 1)':'#eee'}">
2.1立方米以上
<view class="duoxuan" @tap="checkWeightOrVolume"
:style="{'background':addFormData.isOverweightOrOvervolume?'rgba(166, 255, 234, 1)':'#eee'}">
超重超大
</view>
</view>
</view>
<view class="content-box">
<view class="content-box" style="line-height: 100px;">
<view class="content-title">
订单备注<text>*</text>
</view>
<view style="flex: 1;">
<textarea name="" id="" cols="30" rows="10" placeholder="请填写备注"></textarea>
<view style="height: 100px;background: #eee;border-radius: 20px;padding: 10px;width: 70%;">
<textarea name="" id="" cols="30" rows="10" placeholder="请填写备注"
style="height: 80px;width: 100%;"></textarea>
</view>
</view>
<view class="content-box">
<view class="content-title">
送达时间<text>*</text>
</view>
<view style="flex: 1;" @tap="$refs.model.open();">
选择送达时间 <uni-icons type="right"></uni-icons>
<view style="flex: 1;font-size: 14px;font-weight: 700;" @tap="checkTime">
{{addFormData.deliveryTime}} <uni-icons type="right"></uni-icons>
</view>
</view>
<view style="width: 100%;height: 120px;"></view>
@ -217,6 +175,13 @@
直接购买
</view>
</view>
<!-- 地址簿弹出层 -->
<uni-popup ref="bookPopup" background-color="#fff">
<view class="book-popup-content">
<address-list></address-list>
</view>
</uni-popup>
<delivery-time-op @dataCallback="dataCallback" @timeCallback="timeCallback" :dodge="true" ref='model'
:content="content" :barHidth='600' title="选择预送达时间">
> </delivery-time-op>
@ -225,6 +190,7 @@
<script>
import deliveryTimeOp from '@/components/delivery-time-op/delivery-time-op.vue'
import addressList from '@/package1/address/addressList.vue'
export default {
data() {
return {
@ -240,49 +206,111 @@
code: ''
}],
picture: [],
weight: '',
volume: ''
isOverweightOrOvervolume: false,
deliveryTime: '立即送达'
},
content: [{
timezh: "今天 (周三)",
timeformatter: "8-10",
id: 108,
timelist: [{
timestr: "立即送达",
}, {
timestr: "15:35",
}, {
timestr: "16:05",
}, {
timestr: "16:35",
}, {
timestr: "17:05",
}, {
timestr: "17:35",
}, {
timestr: "18:05",
}, {
timestr: "18:35",
}]
}]
content: []
}
},
components: {
deliveryTimeOp
deliveryTimeOp,
addressList
},
onLoad() {
},
onShow() {
this.menuButtonInfo = uni.getMenuButtonBoundingClientRect()
},
methods: {
checkWeightOrVolume(type, value) {
if (type == 'weight') {
this.addFormData.weight = value
} else {
this.addFormData.volume = value
openAddressBook(){
this.$refs.bookPopup.open('bottom')
},
checkTime(){
this.$refs.model.open();
this.generateDeliveryTimes()
},
//
generateDeliveryTimes() {
const now = new Date();
const today = new Date(now);
const tomorrow = new Date(now);
tomorrow.setDate(tomorrow.getDate() + 1);
//
const weekdays = ['周日', '周一', '周二', '周三', '周四', '周五', '周六'];
const todayWeekday = weekdays[today.getDay()];
const todayStr = `今天 (${todayWeekday})`;
// -
const month = tomorrow.getMonth() + 1;
const day = tomorrow.getDate();
const tomorrowStr = `${month}-${day}`;
// ----- -----
const todayTimelist = [{
timestr: '自动送达'
}];
const currentHour = now.getHours();
const currentMinute = now.getMinutes();
//
let nextHour = currentHour;
let nextMinute = 30;
if (currentMinute >= 30) {
nextHour = currentHour + 1;
nextMinute = 0;
}
// 23:30
for (let h = nextHour; h <= 23; h++) {
const startMin = (h === nextHour) ? nextMinute : 0;
for (let m = startMin; m < 60; m += 30) {
if (h === 23 && m > 30) continue; // 23:30
const timeStr = `${h.toString().padStart(2, '0')}:${m.toString().padStart(2, '0')}`;
todayTimelist.push({
timestr: timeStr
});
}
}
// ----- 00:00 ~ 23:30-----
const tomorrowTimelist = [];
for (let h = 0; h <= 23; h++) {
for (let m = 0; m < 60; m += 30) {
if (h === 23 && m > 30) continue;
const timeStr = `${h.toString().padStart(2, '0')}:${m.toString().padStart(2, '0')}`;
tomorrowTimelist.push({
timestr: timeStr
});
}
}
this.content = [{
timezh: todayStr,
timelist: todayTimelist
},
{
timezh: tomorrowStr,
timelist: tomorrowTimelist
}
];
},
//
dataCallback(type) {
console.log("11111111111")
},
//
timeCallback(val) {
this.addFormData.deliveryTime = val.timestr
this.$refs.model.close()
},
checkWeightOrVolume() {
this.addFormData.isOverweightOrOvervolume = !this.addFormData.isOverweightOrOvervolume
},
addCode() {
this.addFormData.codeList.push({

Loading…
Cancel
Save