From 775c5f663c90587447a34fe5b087a248acda7f36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E5=BE=81?= Date: Mon, 16 May 2022 16:12:12 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=BF=AE=E6=94=B9=E7=A6=85=E9=81=93bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/BsAddress.vue | 110 +++++++++++++++++++++--- components/BsLogin.vue | 2 +- pages/account/index/address.vue | 28 +++--- pages/account/index/message.vue | 148 ++++++++++++++++++++++++++++++-- pages/goods/detail/_id.vue | 82 +++++++++++++++++- 5 files changed, 336 insertions(+), 34 deletions(-) diff --git a/components/BsAddress.vue b/components/BsAddress.vue index 94d3db5..a34308c 100644 --- a/components/BsAddress.vue +++ b/components/BsAddress.vue @@ -5,7 +5,7 @@
收货地址 默认地址 - 修改 + 修改
收货地址: @@ -73,6 +73,7 @@ type="textarea" :rows="3" class="max-ipt" + maxlength="60" >
@@ -88,11 +89,11 @@
设为默认地址 -
+
取消 保存地址{{ getEditState ? "保存" : "新增" }}地址
@@ -115,13 +116,25 @@
-
收货人:{{ item.name }}
-
手机号码:{{ item.phone }}
-
收货地址:{{ item.detailAddress }}
+
+ 收 货 人 :{{ item.name }} +
+
+ 手机号码:{{ item.phone }} +
+
+ 收货地址: + {{ item.province + item.city + item.area + item.detailAddress }} +
@@ -150,7 +163,7 @@ export default { type: Boolean, default: false, }, - isEdit: { + isParentEdit: { type: Boolean, default: false, }, @@ -159,14 +172,20 @@ export default { prop: "addressData", event: "emitAddress", }, + computed: { + getEditState() { + return this.isEdit || this.isParentEdit; + }, + }, data() { return { + isEdit: false, isOperation: false, dialogVisible: false, detailAddress: "", addressUser: "", addressPhone: "", - defaultAddress: true, + defaultAddress: false, selectData: { area: { value: "", @@ -187,12 +206,24 @@ export default { this.getAddressData(); }, methods: { + onEdit() { + let vm = this; + let curIndex = vm.addressList.findIndex( + (item) => item.id == vm.curAddressListItem.id + ); + vm.isOperation = true; + vm.isEdit = true; + vm.setAddressData(curIndex); + }, async getAddressData() { let vm = this; let res = await ApiGetAddress(); if (res.result && res.result.length) { vm.isOperation = false; vm.addressList = res.result; + if (!vm.addressList.length) { + vm.defaultAddress = true; + } let curIndex = vm.addressList.findIndex((item) => item.isDefault); vm.curAddressListItem = curIndex > -1 ? vm.addressList[curIndex] : vm.addressList[0]; @@ -257,7 +288,7 @@ export default { provinceCode: vm.selectData.province.code, }; let res; - if (vm.isEdit) { + if (vm.getEditState) { let editParams = Object.assign(vm.addressList[vm.editIndex], params); res = await ApiPutAddress(editParams); } else { @@ -265,6 +296,15 @@ export default { } if (!res.error) { vm.$message.success("添加成功!"); + vm.$set(vm.selectData.area, "value", ""); + vm.$set(vm.selectData.city, "value", ""); + vm.$set(vm.selectData.province, "value", ""); + vm.$set(vm, "detailAddress", ""); + vm.$set(vm, "defaultAddress", ""); + vm.$set(vm, "addressUser", ""); + vm.$set(vm, "addressPhone", ""); + vm.$emit("onSaveSuccess"); + vm.isEdit = false; vm.getAddressData(); } console.log(res); @@ -355,6 +395,22 @@ export default { margin-right: 10px; } } + + &__edit { + flex: 1; + &--btns { + margin-top: 30px; + /deep/.ui-button__grey { + width: 90px; + height: 30px; + font-size: 14px; + font-family: Source Han Sans CN-Regular, Source Han Sans CN; + font-weight: 400; + color: #666666; + margin-right: 38px; + } + } + } } .address__list { @@ -376,11 +432,41 @@ export default { border-radius: 10px; background-color: #eeeeee; } - &--item { + &-item { width: 320px; height: 120px; border: 1px solid #dddddd; margin-bottom: 24px; + cursor: pointer; + padding: 16px 20px; + > div { + margin-bottom: 10px; + } + + &--detail { + @include ellipses(2); + } + + &--label { + font-size: 14px; + font-family: Source Han Sans CN-Regular, Source Han Sans CN; + font-weight: 400; + color: #999999; + } + } + + &-active { + border: 1px solid #ff875b; + position: relative; + &::after { + content: ""; + position: absolute; + right: 0; + bottom: 0; + width: 24px; + height: 24px; + background: url(@/assets/img/goods/active.png); + } } } diff --git a/components/BsLogin.vue b/components/BsLogin.vue index df04795..8500170 100644 --- a/components/BsLogin.vue +++ b/components/BsLogin.vue @@ -150,7 +150,7 @@ export default { const { result, error } = await ApiPostLogin({ ...this.form, clientId: 1, - systemId: 3, + systemId: 1, }); if (error !== null) { Message.error( diff --git a/pages/account/index/address.vue b/pages/account/index/address.vue index 97b0987..b0153cd 100644 --- a/pages/account/index/address.vue +++ b/pages/account/index/address.vue @@ -12,8 +12,9 @@ @@ -57,6 +58,9 @@ export default { }; }, methods: { + onSaveSuccess() { + this.isEdit = false; + }, getList(list) { this.addressList = list || []; }, @@ -76,17 +80,21 @@ export default { }, deleteItem(item) { let vm = this; - vm.$alert("确认删除此收货地址吗?", "提示", { + vm.$confirm("确认删除此收货地址吗?", "提示", { confirmButtonText: "确定", - callback: async () => { - let res = await ApiDeleteAddress({ - idList: [item.id], - }); - if (!res.error) { - vm.$message.success("删除成功~"); - vm.$refs.bsAddress.getAddressData(); + cancelButtonText: "取消", + callback: async (e) => { + console.log(e); + if (e == `confirm`) { + let res = await ApiDeleteAddress({ + idList: [item.id], + }); + if (!res.error) { + vm.$message.success("删除成功~"); + vm.$refs.bsAddress.getAddressData(); + } + console.log(res); } - console.log(res); }, }); }, diff --git a/pages/account/index/message.vue b/pages/account/index/message.vue index 4dc0aea..cf66be9 100644 --- a/pages/account/index/message.vue +++ b/pages/account/index/message.vue @@ -7,17 +7,149 @@ --> \ No newline at end of file + &-img { + width: 110px; + height: 110px; + margin-right: 20px; + } + + &-content { + width: 840px; + &--title { + margin-top: 8px; + font-size: 16px; + font-family: Microsoft YaHei-Regular, Microsoft YaHei; + font-weight: 400; + color: #333333; + } + &--time { + font-size: 12px; + font-family: Microsoft YaHei-Regular, Microsoft YaHei; + font-weight: 400; + color: #999999; + margin-left: auto; + } + &--txt { + margin-top: auto; + margin-bottom: 8px; + font-size: 14px; + font-family: Microsoft YaHei-Regular, Microsoft YaHei; + font-weight: 400; + color: #999999; + } + } + } + } +} + diff --git a/pages/goods/detail/_id.vue b/pages/goods/detail/_id.vue index 96b7302..e7f9996 100644 --- a/pages/goods/detail/_id.vue +++ b/pages/goods/detail/_id.vue @@ -97,6 +97,7 @@ >假一赔四 · 全国包邮 · 不支持7天无理由退换 服务 此商品暂无库存啦~看看其他的吧
-
+
加入购物车 立即购买
@@ -169,6 +170,31 @@
+ + +
+
+

假一赔四

+

正品保障,假一赔四

+
+
+

全国包邮

+

偏远地区(青海、西藏、新疆)除外

+
+
+

不支持7天退换

+

此商品不支持七天无理由退换

+
+
+
+ 确定 +
+