Merge branch 'feature/task1.0.0-0507-zz' into feature/task1.0.0

merge-requests/64/head
张征 3 years ago
commit 44ee987139

Binary file not shown.

After

Width:  |  Height:  |  Size: 330 B

@ -5,7 +5,7 @@
<div class="address__msg-line flex flex-middle"> <div class="address__msg-line flex flex-middle">
<img src="@/assets/img/goods/point.png" alt="收货地址" /> <img src="@/assets/img/goods/point.png" alt="收货地址" />
<span class="address__msg-line--txt">默认地址</span> <span class="address__msg-line--txt">默认地址</span>
<UiButton type="yellow_panel"></UiButton> <UiButton type="yellow_panel" @click="onEdit()"></UiButton>
</div> </div>
<div class="address__msg-line flex flex-middle"> <div class="address__msg-line flex flex-middle">
<span class="address__msg-line--type">收货地址:</span> <span class="address__msg-line--type">收货地址:</span>
@ -73,6 +73,7 @@
type="textarea" type="textarea"
:rows="3" :rows="3"
class="max-ipt" class="max-ipt"
maxlength="60"
></el-input> ></el-input>
</div> </div>
<div class="address__msg-line flex flex-middle"> <div class="address__msg-line flex flex-middle">
@ -88,11 +89,11 @@
</article> </article>
<div class="hr" v-if="!isAccount"></div> <div class="hr" v-if="!isAccount"></div>
<div <div
class="address__operation flex flex-middle" class="address__edit flex flex-middle"
:class="!isAccount ? 'flex-column' : ''" :class="!isAccount ? 'flex-column' : ''"
> >
<el-checkbox v-model="defaultAddress"></el-checkbox> <el-checkbox v-model="defaultAddress"></el-checkbox>
<div> <div class="address__edit--btns flex flex-middle">
<UiButton <UiButton
v-if="addressList && addressList.length && !isAccount" v-if="addressList && addressList.length && !isAccount"
type="grey" type="grey"
@ -100,7 +101,7 @@
>取消</UiButton >取消</UiButton
> >
<UiButton type="yellow_panel" @click="onAddAddress" <UiButton type="yellow_panel" @click="onAddAddress"
>保存地址</UiButton >{{ getEditState ? "保存" : "新增" }}地址</UiButton
> >
</div> </div>
</div> </div>
@ -115,13 +116,25 @@
<div class="address__list"> <div class="address__list">
<section <section
@click="onAddressItem(item)" @click="onAddressItem(item)"
class="address__list--item" class="address__list-item"
:class="
item.id == curAddressListItem.id ? 'address__list-active' : ''
"
v-for="item in addressList" v-for="item in addressList"
:key="item.id" :key="item.id"
> >
<div>收货人{{ item.name }}</div> <div class="address__list-item--name">
<div>手机号码{{ item.phone }}</div> <span class="address__list-item--label"> </span
<div>收货地址{{ item.detailAddress }}</div> >{{ item.name }}
</div>
<div class="address__list-item--phone">
<span class="address__list-item--label">手机号码</span
>{{ item.phone }}
</div>
<div class="address__list-item--detail">
<span class="address__list-item--label">收货地址</span>
{{ item.province + item.city + item.area + item.detailAddress }}
</div>
</section> </section>
</div> </div>
<span slot="footer" class="dialog-footer flex flex-between"> <span slot="footer" class="dialog-footer flex flex-between">
@ -150,7 +163,7 @@ export default {
type: Boolean, type: Boolean,
default: false, default: false,
}, },
isEdit: { isParentEdit: {
type: Boolean, type: Boolean,
default: false, default: false,
}, },
@ -159,14 +172,20 @@ export default {
prop: "addressData", prop: "addressData",
event: "emitAddress", event: "emitAddress",
}, },
computed: {
getEditState() {
return this.isEdit || this.isParentEdit;
},
},
data() { data() {
return { return {
isEdit: false,
isOperation: false, isOperation: false,
dialogVisible: false, dialogVisible: false,
detailAddress: "", detailAddress: "",
addressUser: "", addressUser: "",
addressPhone: "", addressPhone: "",
defaultAddress: true, defaultAddress: false,
selectData: { selectData: {
area: { area: {
value: "", value: "",
@ -187,12 +206,24 @@ export default {
this.getAddressData(); this.getAddressData();
}, },
methods: { 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() { async getAddressData() {
let vm = this; let vm = this;
let res = await ApiGetAddress(); let res = await ApiGetAddress();
if (res.result && res.result.length) { if (res.result && res.result.length) {
vm.isOperation = false; vm.isOperation = false;
vm.addressList = res.result; vm.addressList = res.result;
if (!vm.addressList.length) {
vm.defaultAddress = true;
}
let curIndex = vm.addressList.findIndex((item) => item.isDefault); let curIndex = vm.addressList.findIndex((item) => item.isDefault);
vm.curAddressListItem = vm.curAddressListItem =
curIndex > -1 ? vm.addressList[curIndex] : vm.addressList[0]; curIndex > -1 ? vm.addressList[curIndex] : vm.addressList[0];
@ -257,7 +288,7 @@ export default {
provinceCode: vm.selectData.province.code, provinceCode: vm.selectData.province.code,
}; };
let res; let res;
if (vm.isEdit) { if (vm.getEditState) {
let editParams = Object.assign(vm.addressList[vm.editIndex], params); let editParams = Object.assign(vm.addressList[vm.editIndex], params);
res = await ApiPutAddress(editParams); res = await ApiPutAddress(editParams);
} else { } else {
@ -265,6 +296,15 @@ export default {
} }
if (!res.error) { if (!res.error) {
vm.$message.success("添加成功!"); 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(); vm.getAddressData();
} }
console.log(res); console.log(res);
@ -355,6 +395,22 @@ export default {
margin-right: 10px; 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 { .address__list {
@ -376,11 +432,41 @@ export default {
border-radius: 10px; border-radius: 10px;
background-color: #eeeeee; background-color: #eeeeee;
} }
&--item { &-item {
width: 320px; width: 320px;
height: 120px; height: 120px;
border: 1px solid #dddddd; border: 1px solid #dddddd;
margin-bottom: 24px; 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);
}
} }
} }

@ -12,8 +12,9 @@
<BsAddress <BsAddress
ref="bsAddress" ref="bsAddress"
@getList="getList" @getList="getList"
@onSaveSuccess="onSaveSuccess"
:isAccount="true" :isAccount="true"
:isEdit="isEdit" :isParentEdit="isEdit"
></BsAddress> ></BsAddress>
<el-table :data="addressList" style="width: 100%"> <el-table :data="addressList" style="width: 100%">
<el-table-column prop="name" label="收货人" width="130px"> <el-table-column prop="name" label="收货人" width="130px">
@ -57,6 +58,9 @@ export default {
}; };
}, },
methods: { methods: {
onSaveSuccess() {
this.isEdit = false;
},
getList(list) { getList(list) {
this.addressList = list || []; this.addressList = list || [];
}, },
@ -76,9 +80,12 @@ export default {
}, },
deleteItem(item) { deleteItem(item) {
let vm = this; let vm = this;
vm.$alert("确认删除此收货地址吗?", "提示", { vm.$confirm("确认删除此收货地址吗?", "提示", {
confirmButtonText: "确定", confirmButtonText: "确定",
callback: async () => { cancelButtonText: "取消",
callback: async (e) => {
console.log(e);
if (e == `confirm`) {
let res = await ApiDeleteAddress({ let res = await ApiDeleteAddress({
idList: [item.id], idList: [item.id],
}); });
@ -87,6 +94,7 @@ export default {
vm.$refs.bsAddress.getAddressData(); vm.$refs.bsAddress.getAddressData();
} }
console.log(res); console.log(res);
}
}, },
}); });
}, },

@ -7,17 +7,149 @@
--> -->
<template> <template>
<div>我是消息页面</div> <div>
<main class="main">
<h3 class="title">消息通知</h3>
<section class="section">
<div class="section__item flex" v-for="item in msgList" :key="item.id">
<img
class="section__item-img"
src="https://img1.baidu.com/it/u=3384796346,381674655&fm=253&fmt=auto&app=138&f=JPEG?w=889&h=500"
alt="消息通知"
/>
<div class="section__item-content flex flex-column">
<div class="section__item-content--title flex">
<span>{{ item.payload.title || `马士兵严选上新啦` }}</span>
<span class="section__item-content--time">{{
item.createTimeStamp
}}</span>
</div>
<div class="section__item-content--txt">
{{
item.payload.content ||
`马士兵严选上新啦!!走过路过不要错过,大家快来看看...`
}}
</div>
</div>
</div>
</section>
</main>
</div>
</template> </template>
<script> <script>
import { mapState } from "vuex";
export default { export default {
data(){ data() {
return { return {
Socket: null,
msgList: [],
};
},
computed: {
...mapState(["token"]),
},
mounted() {
// let url = `ws://192.168.10.93:8090/ws?client=eyJhbGciOiJSUzI1NiJ9.eyJleHAiOjQwNzA4ODAwMDAsImlkIjoyLCJ0aW1lIjoxNjUyNDQyMDIyMjE4fQ.ybPvJ-pkywqzBgAK9Lv_7yme50cGhtTvzVcfp-kLyjlzKpsgcvQrhd_FhCHZo-eUEN-OuotoLblU94UMa_oKZ1TU78gjzPWeUpUO9LZVOs0HKIxeFmPbJTe0js5Ckw79p8uTNyO6p9DmZTb3TsX9OmoNoeTDkZLMiJsIXEi9eRU&type=1`;
let url = `wss://k8s-horse-gateway.mashibing.cn/ws?client=${this.token}&type=1`;
this.socket(url);
},
methods: {
socket(url) {
let vm = this;
vm.Socket = new WebSocket(url);
vm.Socket.onopen = () => {
let traceId = Math.random();
vm.Socket.send(
`{"traceId":${traceId},traceType:1,"content":{"size": 100}}`
);
};
vm.Socket.onclose = () => {
vm.Socket = null;
};
vm.Socket.onerror = () => {
if (vm.Socket.readyState !== 3) {
if (vm.reconnection > 3) {
// vm.$message.error("!");
return;
} }
} }
} };
vm.Socket.onmessage = (e) => {
if (e.data == `pong`) {
return;
}
let msg = JSON.parse(e.data);
console.log("websocket收到消息", msg);
if (msg.traceType == 1) {
let traceId = Math.random();
let sys = msg.content.sessionVOS.find((item) => item.type != 3);
let str = `{"traceId":${traceId},traceType:2,"content":{"sessionId":${sys.id}}}`;
vm.Socket.send(str);
}
if (msg.traceType == 2) {
vm.msgList = msg.content;
}
};
},
},
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.main {
width: 1000px;
.title {
width: 100%;
height: 42px;
background: #f8f8f8;
border: 1px solid #dddddd;
padding: 0 24px;
font-size: 14px;
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
font-weight: 400;
color: #333333;
line-height: 42px;
}
.section {
padding: 22px 20px 0;
border: 1px solid #ddd;
margin-top: -1px;
&__item {
margin-bottom: 20px;
&-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;
}
}
}
}
}
</style> </style>

@ -97,6 +97,7 @@
>假一赔四 · 全国包邮 · 不支持7天无理由退换</span >假一赔四 · 全国包邮 · 不支持7天无理由退换</span
> >
<img <img
@click="onShowService()"
class="msg-icon" class="msg-icon"
src="~/assets/img/goods/more.png" src="~/assets/img/goods/more.png"
alt="服务" alt="服务"
@ -135,7 +136,7 @@
<img src="@/assets/img/goods/tips.png" alt="" /> <img src="@/assets/img/goods/tips.png" alt="" />
<span>此商品暂无库存啦~看看其他的吧</span> <span>此商品暂无库存啦~看看其他的吧</span>
</div> </div>
<div class="main__details-pay"> <div class="main__details-pay" v-if="isStock()">
<UiButton type="yellow_line" @click="addCart"></UiButton> <UiButton type="yellow_line" @click="addCart"></UiButton>
<UiButton type="yellow_panel" @click="buyNow"></UiButton> <UiButton type="yellow_panel" @click="buyNow"></UiButton>
</div> </div>
@ -169,6 +170,31 @@
</div> </div>
</section> </section>
<BsChosen v-else></BsChosen> <BsChosen v-else></BsChosen>
<el-dialog
title="服务详情"
:visible.sync="showService"
width="380px"
center
>
<section class="service__section flex flex-column">
<div class="service-item">
<h3>假一赔四</h3>
<p>正品保障假一赔四</p>
</div>
<div class="service-item">
<h3>全国包邮</h3>
<p>偏远地区青海西藏新疆除外</p>
</div>
<div class="service-item">
<h3>不支持7天退换</h3>
<p>此商品不支持七天无理由退换</p>
</div>
</section>
<div class="flex flex-center">
<UiButton type="yellow_panel service-btn" @click="showService=false;"></UiButton>
</div>
</el-dialog>
</div> </div>
</template> </template>
<script> <script>
@ -199,6 +225,7 @@ export default {
timer: null, timer: null,
startTime: "", startTime: "",
endTime: "", endTime: "",
showService: false,
}; };
}, },
async created() { async created() {
@ -264,6 +291,9 @@ export default {
}, },
}, },
methods: { methods: {
onShowService() {
this.showService = true;
},
addCart() { addCart() {
let ids = [this.detailData.id]; let ids = [this.detailData.id];
this.$router.push({ this.$router.push({
@ -418,6 +448,9 @@ export default {
}); });
}, },
buyNow() { buyNow() {
if (!this.$isLoginValidate()) {
return;
}
if (!this.curSku.skuId) { if (!this.curSku.skuId) {
this.$message.error("请选择规格~"); this.$message.error("请选择规格~");
return false; return false;
@ -440,6 +473,9 @@ export default {
* 加入购物车 * 加入购物车
*/ */
async addCart() { async addCart() {
if (!this.$isLoginValidate()) {
return;
}
if (!this.curSku.skuId) { if (!this.curSku.skuId) {
this.$message.error("请选择规格~"); this.$message.error("请选择规格~");
return false; return false;
@ -602,6 +638,7 @@ export default {
margin-left: 6px; margin-left: 6px;
width: 12px; width: 12px;
height: 12px; height: 12px;
cursor: pointer;
} }
&--price { &--price {
padding-bottom: 30px; padding-bottom: 30px;
@ -734,7 +771,7 @@ export default {
width: 1200px; width: 1200px;
margin: 64px auto 0; margin: 64px auto 0;
&-recommend { &-recommend {
width: 210px; width: 232px;
margin-right: 30px; margin-right: 30px;
/deep/.goods-item { /deep/.goods-item {
@ -742,7 +779,7 @@ export default {
} }
} }
&-details { &-details {
width: 960px; width: 938px;
&--none { &--none {
img { img {
@ -775,4 +812,43 @@ export default {
color: #666666; color: #666666;
} }
} }
.service-item {
margin-bottom: 25px;
padding-left: 30px;
h3 {
font-size: 18px;
font-family: Microsoft YaHei-Regular, Microsoft YaHei;
font-weight: 400;
color: #333333;
position: relative;
&::before {
content: "";
position: absolute;
left: -10px;
top: 50%;
margin-top: -3px;
height: 6px;
width: 6px;
background: #ff875b;
border-radius: 50%;
}
}
p {
font-size: 14px;
font-family: Microsoft YaHei-Regular, Microsoft YaHei;
font-weight: 400;
color: #666666;
padding-top: 10px;
}
}
.service-btn {
width: 272px;
height: 36px;
background: linear-gradient(90deg, #ff7f39 0%, #ffa35b 100%);
border-radius: 4px;
}
</style> </style>

Loading…
Cancel
Save