From 990bb4bf1e6162585f0c578459b60d3836862e08 Mon Sep 17 00:00:00 2001
From: lion <120344285@qq.com>
Date: Fri, 26 Jul 2024 13:21:22 +0800
Subject: [PATCH] =?UTF-8?q?=E5=8F=AA=E8=83=BD=E6=8F=90=E4=B8=A4=E5=A4=A9?=
=?UTF-8?q?=E4=B9=8B=E5=90=8E=E7=9A=84=E6=97=A5=E6=9C=9F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
packages/order/order.vue | 363 ++++++++++++++++++++-------------------
1 file changed, 190 insertions(+), 173 deletions(-)
diff --git a/packages/order/order.vue b/packages/order/order.vue
index 20f6ecd..566c23a 100644
--- a/packages/order/order.vue
+++ b/packages/order/order.vue
@@ -34,29 +34,30 @@
-
-
-
- 发货时间
-
-
-
-
- {{form.ymd}} [{{form.week}}]
-
-
-
-
- 选择发货时间
-
-
-
-
-
-
+
+
+
+ 发货时间
+
+
+
+
+ {{form.ymd}} [{{form.week}}]
+
+
+
+
+ 选择发货时间
+
+
+
+
+
+
非到货时间,预计发货后48小时左右可到货。
-
+
@@ -69,7 +70,7 @@
-
+
@@ -97,7 +98,7 @@
-
+
@@ -115,11 +116,12 @@
温馨提示
-
+
- 我同意({{isAgreeTime}})
+ 我同意({{isAgreeTime}})
@@ -129,8 +131,8 @@
+ :src="cardInfo.sku?(cardInfo.sku.image_url?cardInfo.sku.image_url:require('@/static/logo-xietaitai.png')):require('@/static/logo-xietaitai.png')">
+
{{cardInfo.sku?cardInfo.sku.name:''}}
{{cardInfo.sku?cardInfo.sku.specs:''}}
@@ -143,14 +145,14 @@
发货时间
- {{form.ymd}}
- [{{form.week}}]
+ {{form.ymd}}
+ [{{form.week}}]
{{form.lunarData}}
-
+
@@ -223,15 +225,15 @@
data() {
return {
showinfo: false,
- showagree: false,
- isAgree:false,
- isAgreeTime:10,
- agreeTimer:null,
+ showagree: false,
+ isAgree: false,
+ isAgreeTime: 10,
+ agreeTimer: null,
showAddress: false,
listAddress: [],
addressInfo: '',
- cardInfo: {},
- tips:'',
+ cardInfo: {},
+ tips: '',
type: '',
form: {
card_number: '',
@@ -315,12 +317,12 @@
onReady() {
this.$refs.uForm.setRules(this.rules);
- },
- onUnload() {
- if(this.agreeTimer){
- clearInterval(this.agreeTimer)
- this.agreeTimer = null
- }
+ },
+ onUnload() {
+ if (this.agreeTimer) {
+ clearInterval(this.agreeTimer)
+ this.agreeTimer = null
+ }
},
onLoad(option) {
let that = this
@@ -350,12 +352,12 @@
this.form.password = uni.getStorageSync("vuex_card") ? uni.getStorageSync("vuex_card").password : ''
// uni.removeStorageSync("vuex_card")
}
- // 温馨提示
- const configs = uni.getStorageSync("configs")
- configs.map(item=>{
- if(item.key==='tips'){
- this.tips = item.value
- }
+ // 温馨提示
+ const configs = uni.getStorageSync("configs")
+ configs.map(item => {
+ if (item.key === 'tips') {
+ this.tips = item.value
+ }
})
this.getAddress()
this.getDates()
@@ -406,12 +408,17 @@
let data = res.card
if (data.open_dates) {
for (var k in data.open_dates) {
- if (data.open_dates[k]['quantity'] - data.open_dates[k]['booked'] > 0) {
- let _k = this.momentDay(k)
- this.listDates.push({
- canUse: data.open_dates[k],
- ..._k
- })
+ // 剩余数量大于0
+
+ if (data.open_dates[k]['quantity'] - data.open_dates[k]['booked'] > 0) {
+ if(this.isAfterTwoDays(k)){
+ let _k = this.momentDay(k)
+ this.listDates.push({
+ canUse: data.open_dates[k],
+ ..._k
+ })
+ }
+
}
}
}
@@ -419,6 +426,13 @@
})
},
+ isAfterTwoDays(open_dates) {
+ const dateToCheck = this.$moment(open_dates, 'YYYY-MM-DD');
+ const today = this.$moment();
+ const twoDaysAfterToday = today.add(2, 'days');
+
+ return dateToCheck >= twoDaysAfterToday;
+ },
momentDay(date) {
if (date) {
const weeks = ["周日", '周一', '周二', '周三', '周四', '周五', '周六', ]
@@ -515,7 +529,7 @@
})
},
backShow() {
- let that = this
+ let that = this
that.showinfo = false
},
saveDefalutAddress() {
@@ -564,108 +578,108 @@
}
}
- },
- openShowInfo(){
- let that = this
- if (!isNull(this.form.mobile2) && this.form.mobile2.length > 0) {
- if (!isMobile(this.form.mobile2)) {
- toast('备用电话不正确')
- return
- }
- }
- if (!isNull(this.form.buy_mobile) && this.form.buy_mobile.length > 0) {
- if (!isMobile(this.form.buy_mobile)) {
- toast('购买人电话不正确')
- return
- }
- }
- this.$refs.uForm.validate(valid => {
- // console.log('验证通过');
- if (valid) {
- if (!this.showinfo) {
- uni.setNavigationBarTitle({
- title: '信息确认',
- success: function() {
- console.log('标题设置成功');
- that.showinfo = true
- },
- fail: function(err) {
- console.error('标题设置失败', err);
- }
- });
- }
- } else {
- console.log('验证失败');
- // toast('请填写完整信息')
- }
- });
- },
- closeAgree(){
- if(this.isAgreeTime>0){
- return
- }else{
- this.isAgree = true
- this.showagree = false
- }
- },
- reduceAgreeTime(){
- let that = this
- if(that.isAgreeTime>0){
- this.agreeTimer = setInterval(function(){
- that.isAgreeTime--
- if(that.isAgreeTime===0){
- that.isAgree = true
- that.isAgreeTime = 0
- clearInterval(that.agreeTimer)
- that.agreeTimer = null
- }
- },1000)
- }
-
},
- submit() {
+ openShowInfo() {
+ let that = this
+ if (!isNull(this.form.mobile2) && this.form.mobile2.length > 0) {
+ if (!isMobile(this.form.mobile2)) {
+ toast('备用电话不正确')
+ return
+ }
+ }
+ if (!isNull(this.form.buy_mobile) && this.form.buy_mobile.length > 0) {
+ if (!isMobile(this.form.buy_mobile)) {
+ toast('购买人电话不正确')
+ return
+ }
+ }
+ this.$refs.uForm.validate(valid => {
+ // console.log('验证通过');
+ if (valid) {
+ if (!this.showinfo) {
+ uni.setNavigationBarTitle({
+ title: '信息确认',
+ success: function() {
+ console.log('标题设置成功');
+ that.showinfo = true
+ },
+ fail: function(err) {
+ console.error('标题设置失败', err);
+ }
+ });
+ }
+ } else {
+ console.log('验证失败');
+ // toast('请填写完整信息')
+ }
+ });
+ },
+ closeAgree() {
+ if (this.isAgreeTime > 0) {
+ return
+ } else {
+ this.isAgree = true
+ this.showagree = false
+ }
+ },
+ reduceAgreeTime() {
let that = this
- if(!this.isAgree){
- this.showagree = true
- this.isAgreeTime = 10
- this.reduceAgreeTime()
- }else{
- if(this.isAgree){
- this.form.show = 0
- if (this.type == 'edit') {
- console.log("this.form", this.form)
- this.$u.api.saveUserOrder(this.form).then(res => {
- uni.removeStorageSync('vuex_update_card')
- toast(res.msg, 1000, function() {
- setTimeout(function() {
- that.saveDefalutAddress()
- }, 500)
-
- })
-
- }).then(res => {
- console.log('res1', res)
-
- })
- } else {
- this.$u.api.addUserOrder(this.form).then(res => {
- console.log("res", res)
- uni.removeStorageSync('vuex_card')
- toast(res.msg, 1000, function() {
- setTimeout(function() {
- that.saveDefalutAddress()
- }, 500)
-
- })
-
- }).then(res => {
- console.log('res1', res)
-
- })
- }
-
- }
-
+ if (that.isAgreeTime > 0) {
+ this.agreeTimer = setInterval(function() {
+ that.isAgreeTime--
+ if (that.isAgreeTime === 0) {
+ that.isAgree = true
+ that.isAgreeTime = 0
+ clearInterval(that.agreeTimer)
+ that.agreeTimer = null
+ }
+ }, 1000)
+ }
+
+ },
+ submit() {
+ let that = this
+ if (!this.isAgree) {
+ this.showagree = true
+ this.isAgreeTime = 10
+ this.reduceAgreeTime()
+ } else {
+ if (this.isAgree) {
+ this.form.show = 0
+ if (this.type == 'edit') {
+ console.log("this.form", this.form)
+ this.$u.api.saveUserOrder(this.form).then(res => {
+ uni.removeStorageSync('vuex_update_card')
+ toast(res.msg, 1000, function() {
+ setTimeout(function() {
+ that.saveDefalutAddress()
+ }, 500)
+
+ })
+
+ }).then(res => {
+ console.log('res1', res)
+
+ })
+ } else {
+ this.$u.api.addUserOrder(this.form).then(res => {
+ console.log("res", res)
+ uni.removeStorageSync('vuex_card')
+ toast(res.msg, 1000, function() {
+ setTimeout(function() {
+ that.saveDefalutAddress()
+ }, 500)
+
+ })
+
+ }).then(res => {
+ console.log('res1', res)
+
+ })
+ }
+
+ }
+
}
}
}
@@ -792,13 +806,15 @@
padding: 0;
.u-form-item__body {
- align-items: baseline;
- .u-form-item--left{
- width:0!important;
- flex:0!important;
+ align-items: baseline;
+
+ .u-form-item--left {
+ width: 0 !important;
+ flex: 0 !important;
}
}
}
+
.hh {
&:last-child {
text-align: right;
@@ -920,8 +936,8 @@
}
.imgbox {
- width: 150rpx;
- height:150rpx;
+ width: 150rpx;
+ height: 150rpx;
margin: 0 auto;
border-radius: 10rpx;
border: 1px solid #ba8b45;
@@ -930,8 +946,8 @@
}
.imgbox image {
- width: 150rpx;
- height:150rpx;
+ width: 150rpx;
+ height: 150rpx;
vertical-align: middle;
}
@@ -982,7 +998,7 @@
font-size: 32rpx;
color: #000;
font-weight: bold;
- margin-bottom: 8rpx;
+ margin-bottom: 8rpx;
text-align: center;
}
@@ -1051,22 +1067,22 @@
&-title {
font-size: 32rpx;
- margin-bottom: 30rpx;
- color:#b62828;
+ margin-bottom: 30rpx;
+ color: #b62828;
text-align: center;
}
&-content {
line-height: 1.8;
- font-size: 30rpx;
- height:300rpx;
+ font-size: 30rpx;
+ height: 300rpx;
overflow: scroll;
}
&-btn {
>view {
- background-color: rgba(0,0,0,0.5);
+ background-color: rgba(0, 0, 0, 0.5);
color: #fff;
border-radius: 40rpx;
width: 60%;
@@ -1075,9 +1091,10 @@
text-align: center;
line-height: 75rpx;
margin: 20rpx auto;
- }
- .canAgree{
- background-color: #ba8b45;
+ }
+
+ .canAgree {
+ background-color: #ba8b45;
}
}
}