diff --git a/common/util.js b/common/util.js index f40cf5b..3860b02 100644 --- a/common/util.js +++ b/common/util.js @@ -162,6 +162,16 @@ const toMapAPP = (lat,lng,name) => { } }) +} +// 检查是否空对象 +const isEmptyObject = (obj) => { + // 检查传入参数是否为一个对象 + if (typeof obj !== 'object' || obj === null) { + throw new Error('Input must be an object'); + } + + // 使用Object.keys()方法获取对象的属性键数组,并检查其长度是否为0 + return Object.keys(obj).length === 0; } export { @@ -174,5 +184,6 @@ export { isMobile, getDistance, toMapAPP, - shareInfo + shareInfo, + isEmptyObject } \ No newline at end of file diff --git a/components/date-picker/date-picker.vue b/components/date-picker/date-picker.vue index 084f024..3b91381 100644 --- a/components/date-picker/date-picker.vue +++ b/components/date-picker/date-picker.vue @@ -4,43 +4,49 @@ 配送 - + - - - - {{item.value}} - - 送货时间 - - - - - {{item.ymd}}[{{item.week}}] - - - - - - {{dateObj.lunarData?dateObj.lunarData:''}} - - - - {{item}} - - - + + + {{item.value}} + + + 送货时间 + + + + + {{item.ymd}}[{{item.week}}] + + + + + + {{dateObj.lunarData?dateObj.lunarData:''}} + + + + {{item}} + + + + + + 确定 - - \ No newline at end of file diff --git a/packages/my/addaddress.vue b/packages/my/addaddress.vue index f693691..078145c 100644 --- a/packages/my/addaddress.vue +++ b/packages/my/addaddress.vue @@ -2,7 +2,7 @@ 微信地址 - + @@ -18,10 +18,14 @@ + + + - - 提交 + + 提交 @@ -47,7 +51,8 @@ area: '', address: '', contact: '', - mobile: '' + mobile: '', + defalut:false }, listArea:[], showArea: false, @@ -181,9 +186,17 @@ this.$refs.uForm.validate(valid => { if (valid) { + if(this.form.defalut){ + this.form.defalut = 1 + } this.$u.api.saveUserAddress(this.form).then(res=>{ - toast('提交成功') - uni.navigateBack(-1) + toast('提交成功',1000,function(){ + setTimeout(function(){ + uni.navigateBack(-1) + },500) + + }) + }) } else { console.log('验证失败'); @@ -200,7 +213,7 @@ padding: 40rpx; .orderForm { &-wx{ - color:#2979ff; + color:#ba8b45; margin-bottom:20rpx; font-size: 32rpx; } @@ -225,7 +238,17 @@ } &-btn { - margin: 40rpx; + margin: 40rpx; + >view{ + background-color: #ba8b45; + color: #fff; + border-radius: 40rpx; + width: 100%; + margin: 0 auto; + height: 75rpx; + text-align: center; + line-height: 75rpx; + } } } } diff --git a/packages/my/address.vue b/packages/my/address.vue index e123f90..e94976f 100644 --- a/packages/my/address.vue +++ b/packages/my/address.vue @@ -20,7 +20,7 @@ - + 新增地址 @@ -146,7 +146,7 @@ } } &-add{ - color:#2979ff; + color:#ba8b45; margin: 20rpx 0; font-size: 32rpx; u-icon{ diff --git a/packages/myorder/infoconfirm.vue b/packages/myorder/infoconfirm.vue index 06b5b76..a1655e7 100644 --- a/packages/myorder/infoconfirm.vue +++ b/packages/myorder/infoconfirm.vue @@ -5,8 +5,8 @@ - 蟹太太大闸蟹红金款999型 - 公4.0两母3.0两 4对 8只装 + {{details.sku?details.sku.name:''}} + {{details.sku?details.sku.specs:''}} @@ -16,13 +16,13 @@ 收货日期 - 2024年9月28日 - 农历八月十三 + {{details.send_date?$moment(details.send_date).format("YYYY年M月DD日"):''}} + {{details.lunarData?details.lunarData:""}} - 09:00-15:00 - [周三] - + {{details.hh?details.hh:''}} + {{details.week?'['+details.week+']':''}} + @@ -32,7 +32,7 @@ 收货地址 - 浙江省杭州市滨江区银泰海威国际xxxx + {{details.area?details.area:''}}{{details.address?details.address:''}} @@ -43,15 +43,11 @@ 收货人 - 王冰冰 - 15326589454 + {{details.contact?details.contact:''}} + {{details.mobile?details.mobile:''}} - - 返回修改 - 确认提货 - @@ -60,11 +56,13 @@ data() { return { - + details:{} } }, - onLoad() { - + onLoad(option) { + this.details = uni.getStorageSync('order_detail')?uni.getStorageSync('order_detail'):'' + uni.removeStorageSync('order_detail') + console.log(this.details) }, methods: { diff --git a/packages/myorder/myorder.vue b/packages/myorder/myorder.vue index 911513f..adbf685 100644 --- a/packages/myorder/myorder.vue +++ b/packages/myorder/myorder.vue @@ -5,88 +5,32 @@ - + - 运单号1:SFSF1454237639361 - 已发货 + 运单号:{{item.express_number?item.express_number:'-'}} + {{item.status==0?'待发货':'已发货'}} - + - 蟹太太大闸蟹红金款999型 - 公4.0两母3.0两 4对 8只装 + {{item.sku?item.sku.name:''}} + {{item.sku?item.sku.specs:''}} - + 预计送达时间 - 9月28日[周三]09:00-15:00 + {{item.send_date?$moment(item.send_date).format("M月DD日"):''}}{{item.week?'['+item.week+']':''}}{{item.hh?item.hh:''}} - 删除订单 + 通知收件人 - - - - 商品兑换成功 - 待发货 - - - - - - - - 蟹太太大闸蟹红金款999型 - 公4.0两母3.0两 4对 8只装 - - - - 预计送达时间 - 9月28日[周三]09:00-15:00 - - - 添加备注 - 删除订单 - 通知收件人 - - - - - - - - 商品兑换成功 - 待发货 - - - - - - - - 蟹太太大闸蟹红金款999型 - 公4.0两母3.0两 4对 8只装 - - - - 预计送达时间 - 9月28日[周三]09:00-15:00 - - - 添加备注 - 删除订单 - 通知收件人 - - - - @@ -97,30 +41,42 @@ data() { return { list: [{ - name: '全部' + name: '全部', + status:'', }, { - name: '待发货' + name: '待发货', + status:0 }, { - name: '待收货', - },{ - name: '已完成', - }], - current: 0 + name: '已发货', + status:1 + }], + status:'', + current: 0, + orderList:[] } }, onLoad() { - + this.getOrderList() }, methods: { change(index) { - this.current = index; + this.current = index; + this.status = this.list[index].status + this.getOrderList() }, - toDetail(){ - console.log("123") + toDetail(item){ + uni.setStorageSync('order_detail', item) uni.navigateTo({ url:'/packages/myorder/infoconfirm' }) - } + }, + async getOrderList(){ + const res = await this.$u.api.getUserOrder({ + status:this.status + }) + this.orderList = res + // this.listArea = res.regions + }, } } diff --git a/packages/order/order.vue b/packages/order/order.vue index bf5617a..8a9dede 100644 --- a/packages/order/order.vue +++ b/packages/order/order.vue @@ -1,72 +1,77 @@ @@ -70,47 +87,49 @@ toast, shareInfo } from "@/common/util.js" - import tabbar from '@/components/tabbar/tabbar.vue'; - export default{ - components:{ - tabbar + import tabbar from '@/components/tabbar/tabbar.vue'; + export default { + components: { + tabbar }, data() { return { - navBarTop: 0, - showPhone:false, + navBarTop: 0, + showPhone: false, info: {}, headReplace: require('@/static/share.jpg'), showform: false, maskClose: false, imgurl: '', form: { - nickname: '', - mobile:'' + nickname: '', + mobile: '' }, list: [{ - title: '我的订单', - icon:'order', - url: '/packages/myorder/myorder', - },{ - title: '我的积分', - icon:'coupon', - url: '/packages/my/score', - }, - // { - // title: '卡劵查询', - // icon:'search', - // url: '/packages/card/index', - // }, - { - title: '我的地址', - icon:'map', - url: '/packages/my/address', - },{ - title: '意见反馈', - icon:'info-circle', - url: '/packages/my/feedback', - }] + title: '我的订单', + icon: 'order', + url: '/packages/myorder/myorder', + }, { + title: '我的积分', + icon: 'coupon', + url: '/packages/my/score', + }, + // { + // title: '卡劵查询', + // icon:'search', + // url: '/packages/card/index', + // }, + { + title: '我的地址', + icon: 'map', + url: '/packages/my/address', + }, { + id: 'feedback', + title: '意见反馈', + icon: 'info-circle', + // url: '/packages/my/feedback', + } + ] } }, onShareAppMessage() { @@ -122,34 +141,34 @@ onLoad() { const MenuButton = uni.getMenuButtonBoundingClientRect() this.navBarTop = MenuButton.top //左侧文字与右侧胶囊对齐 - }, - onShow() { - this.getInitUser() + }, + onShow() { + this.getInitUser() }, methods: { - onChooseAvatar(e) { - console.log("e",e) + onChooseAvatar(e) { + console.log("e", e) uni.uploadFile({ url: baseUrl + "/api/mobile/user/upload", filePath: e.detail.avatarUrl, - name: 'file', - header:{ - 'Authorization' : `Bearer ${this.vuex_token}` + name: 'file', + header: { + 'Authorization': `Bearer ${this.vuex_token}` }, success: (res) => { uni.showToast({ title: '上传成功', duration: 1000 - }) - - this.imgurl = JSON.parse(res.data).url + }) + + this.imgurl = JSON.parse(res.data).url this.form.headimgurl = this.imgurl - }, - fail(res){ - uni.showToast({ - title: '上传失败', - duration: 1000 - }) + }, + fail(res) { + uni.showToast({ + title: '上传失败', + duration: 1000 + }) } }) }, @@ -160,30 +179,30 @@ this.form.nickname = e.detail.value } - }, - getUserWxPhone(res) { - if(!res.detail.code){ - this.showPhone = false - return - } - this.$u.api.getUserMobile({ - code: res.detail.code, - iv:res.detail.iv, - encryptedData:res.detail.encryptedData - }).then(res => { - this.form.mobile = res.mobile - this.showPhone = false - this.showform = true - }) + }, + getUserWxPhone(res) { + if (!res.detail.code) { + this.showPhone = false + return + } + this.$u.api.getUserMobile({ + code: res.detail.code, + iv: res.detail.iv, + encryptedData: res.detail.encryptedData + }).then(res => { + this.form.mobile = res.mobile + this.showPhone = false + this.showform = true + }) }, async getInitUser() { const res = await this.$u.api.user() this.$u.vuex('vuex_user', res.user) this.form = res.user this.imgurl = res.user.headimgurl ? res.user.headimgurl : '' - this.info = this.$u.deepClone(res.user); - if(isNull(res.user.mobile)){ - this.showPhone = true + this.info = this.$u.deepClone(res.user); + if (isNull(res.user.mobile)) { + this.showPhone = true } }, submit() { @@ -198,10 +217,10 @@ }) }, toUrl(item) { - if(item.url){ - uni.navigateTo({ - url:item.url - }) + if (item.url) { + uni.navigateTo({ + url: item.url + }) } }, } @@ -265,6 +284,23 @@ color: #666666; border-bottom: 1px solid #e0e0e0; + button { + padding: 0; + margin: 0; + border: 1px solid transparent; + width: 100%; + background: transparent; + display: flex; + justify-content: space-between; + font-size: 28rpx; + color: #666666; + line-height: 1.5; + } + + button::after { + border: none; + } + & image { vertical-align: middle; @@ -344,7 +380,7 @@ &-btn { box-shadow: 0.5px 3px 9px 0px rgba(235, 107, 85, 0.3); - background: #2979ff; + background: #ba8b45; border-radius: 44rpx; text-align: center; height: 88rpx; @@ -356,6 +392,4 @@ } } } - - \ No newline at end of file diff --git a/pages/talk/talk.vue b/pages/talk/talk.vue index e75f472..d96be24 100644 --- a/pages/talk/talk.vue +++ b/pages/talk/talk.vue @@ -10,7 +10,7 @@ - + 长按扫码添加企业微信