@@ -93,11 +93,14 @@
:class="!isAccount ? 'flex-column' : ''"
>
+
取消
item.isDefault);
vm.curAddressListItem =
curIndex > -1 ? vm.addressList[curIndex] : vm.addressList[0];
vm.$emit("getList", vm.addressList);
vm.$emit("emitAddress", vm.curAddressListItem);
} else {
+ vm.defaultAddress = true;
vm.isOperation = true;
}
console.log("获取收货地址", res);
@@ -242,6 +255,9 @@ export default {
vm.$set(vm.selectData.area, "value", editItem.area);
vm.$set(vm.selectData.city, "value", editItem.city);
vm.$set(vm.selectData.province, "value", editItem.province);
+ vm.$set(vm.selectData.area, "code", editItem.areaCode);
+ vm.$set(vm.selectData.city, "code", editItem.cityCode);
+ vm.$set(vm.selectData.province, "code", editItem.provinceCode);
vm.$set(vm, "detailAddress", editItem.detailAddress);
vm.$set(vm, "defaultAddress", editItem.isDefault);
vm.$set(vm, "addressUser", editItem.name);
@@ -254,11 +270,12 @@ export default {
this.dialogVisible = false;
},
onSelected(data) {
- console.log(data);
this.selectData = data;
},
async onAddAddress() {
let vm = this;
+ let curItem = vm.addressList[vm.editIndex]
+ console.log(`vm.addressPhone != curItem.phone`,vm.addressPhone , curItem);
if (!vm.selectData?.area?.code) {
vm.$message.error("请选择所在区域~");
return;
@@ -271,7 +288,7 @@ export default {
vm.$message.error("请输入收货人~");
return;
}
- if (!IsPhone(vm.addressPhone)) {
+ if (!IsPhone(vm.addressPhone) && vm.addressPhone != curItem.phone) {
vm.$message.error("请输入收货人手机号码~");
return;
}
@@ -410,6 +427,9 @@ export default {
margin-right: 38px;
}
}
+ .clearmargin {
+ margin: 0 0 0 20px;
+ }
}
}
diff --git a/components/BsChosen.vue b/components/BsChosen.vue
index 1d74d0d..308f9c6 100644
--- a/components/BsChosen.vue
+++ b/components/BsChosen.vue
@@ -17,7 +17,7 @@
@@ -213,6 +233,11 @@ export default {
width: 164px;
height: 28px;
margin-right: 50px;
+ cursor: pointer;
+ img {
+ width: 100%;
+ height: 100%;
+ }
}
.bar-header-wrap__icons {
cursor: pointer;
@@ -222,7 +247,7 @@ export default {
}
.header-wrap-icons__shop {
position: relative;
- margin-left: 14px;
+ margin-left: 20px;
.wrap-icons-shop__tip {
position: absolute;
left: 18px;
@@ -283,10 +308,11 @@ export default {
@include layout-box;
background: #ffffff;
.bar-header-box__wrap {
- height: 42px;
+ height: 40px;
font-size: 14px;
margin-bottom: 38px;
padding-right: 50px;
+ cursor: pointer;
.header-box-wrap__logo {
width: 244px;
height: 100%;
@@ -297,6 +323,7 @@ export default {
.search-input {
width: 551px;
z-index: 1;
+ border-radius: 4px;
/deep/.el-input__inner:focus {
border-color: #ff512b;
}
@@ -305,7 +332,7 @@ export default {
width: 77px;
margin-left: -2px;
background: linear-gradient(270deg, #ffa25a 0%, #ff7f39 100%);
- border-radius: 0px 8px 8px 0px;
+ border-radius: 0px 4px 4px 0px;
z-index: 2;
cursor: pointer;
img {
@@ -327,6 +354,9 @@ export default {
font-size: 16px;
color: #666666;
cursor: pointer;
+ &:hover {
+ color: #ff875b;
+ }
}
}
}
diff --git a/middleware/redirect.js b/middleware/redirect.js
new file mode 100644
index 0000000..f31f846
--- /dev/null
+++ b/middleware/redirect.js
@@ -0,0 +1,10 @@
+export default function ({ app, route, redirect }) {
+ if (!app.store.state.token) {
+ // 未登录直接打开需要登录的页面,跳转首页
+ const needLoginPage = [/\/account/, /\/cart/];
+ const result = needLoginPage.some((item) => item.test(route.path));
+ if (result) {
+ redirect("/");
+ }
+ }
+}
diff --git a/nuxt.config.js b/nuxt.config.js
index c9c4aef..1288de9 100644
--- a/nuxt.config.js
+++ b/nuxt.config.js
@@ -19,7 +19,7 @@ export default {
{ name: 'format-detection', content: 'telephone=no' }
],
link: [
- { rel: 'icon', type: 'image/x-icon', href: '/logo.png' }
+ { rel: 'icon', type: 'image/x-icon', href: '/logo.ico' }
]
},
router: {
@@ -29,7 +29,8 @@ export default {
path: '/',
component: resolve(__dirname, 'pages/index/index.vue')
})
- }
+ },
+ middleware: ['redirect']
},
// Global CSS: https://go.nuxtjs.dev/config-css
@@ -45,7 +46,8 @@ export default {
'@plugins/axiosTk.js',
'@plugins/vue-inject.js',
'@/plugins/v-distpicker',
- '@/plugins/router'
+ '@/plugins/router',
+ '@/plugins/im'
],
// Auto import components: https://go.nuxtjs.dev/config-components
diff --git a/pages/account/index/message.vue b/pages/account/index/message.vue
index cf66be9..3275547 100644
--- a/pages/account/index/message.vue
+++ b/pages/account/index/message.vue
@@ -11,7 +11,7 @@
消息通知
-
+
- {{ item.payload.title || `马士兵严选上新啦` }}
+ {{ JSON.parse(item.payload).title || `` }}
{{
item.createTimeStamp
}}
{{
- item.payload.content ||
- `马士兵严选上新啦!!走过路过不要错过,大家快来看看...`
+ JSON.parse(item.payload).content ||
+ ``
}}
@@ -40,58 +40,15 @@
import { mapState } from "vuex";
export default {
data() {
- return {
- Socket: null,
- msgList: [],
- };
+ return {};
},
computed: {
- ...mapState(["token"]),
+ ...mapState(["token","socketMsgData"]),
},
- 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;
- }
- };
- },
+ mounted(){
+ console.log(`socketMsgData`,this.$store.state)
},
+ methods: {},
};
diff --git a/pages/account/index/order/saleAfter/list.vue b/pages/account/index/order/saleAfter/list.vue
index e69de29..a69994a 100644
--- a/pages/account/index/order/saleAfter/list.vue
+++ b/pages/account/index/order/saleAfter/list.vue
@@ -0,0 +1,58 @@
+
+
+
+
+ 售后订单
+
+ 请前往APP查看售后订单
+
+
+
+
diff --git a/pages/account/index/userInfo.vue b/pages/account/index/userInfo.vue
index e00f4a5..9a22876 100644
--- a/pages/account/index/userInfo.vue
+++ b/pages/account/index/userInfo.vue
@@ -92,9 +92,21 @@ export default {
computed: {
...mapState(["userInfo", "token"]),
},
+ watch: {
+ userInfo: {
+ deep: true,
+ handler(val) {
+ if (val && Object.keys(val).length > 0) {
+ this.initData();
+ }
+ },
+ },
+ },
created() {
- this.initData();
this.getOssConfig();
+ if (this.userInfo && Object.keys(this.userInfo).length > 0) {
+ this.initData();
+ }
},
methods: {
initData() {
diff --git a/pages/goods/detail/_id.vue b/pages/goods/detail/_id.vue
index b53ae9a..467365a 100644
--- a/pages/goods/detail/_id.vue
+++ b/pages/goods/detail/_id.vue
@@ -1,14 +1,51 @@
-
+
+
@@ -67,13 +104,11 @@
售价
-
+
{{
+ detailData.productActivityVO.isStartActivity
+ ? detailData.productActivityVO.activityPrice
+ : detailData.startingPrice
+ }}
- 确定
+ 确定
@@ -206,12 +243,13 @@ import { ApiPutAddCart } from "@/plugins/api/cart";
import {
ApiGetGoodsDetail,
ApiGetGoodsSkus,
- ApiGetRecommendedGoodsList,
+ ApiGetGoodsList,
} from "@/plugins/api/goods";
export default {
componetns: { UiMoney, UiButton, UiGoodsItem, BsChosen },
data() {
return {
+ pageLoading: true,
curBuyNum: 1,
activeImg: 0,
recommendedData: [],
@@ -233,13 +271,20 @@ export default {
let id = this.$route.params.id;
let res1 = await ApiGetGoodsDetail({ id });
let res2 = await ApiGetGoodsSkus({ productId: id });
- let res3 = await ApiGetRecommendedGoodsList();
+ let res3 = await ApiGetGoodsList({
+ length: 3,
+ pageIndex: 1,
+ name: "",
+ categoryId: "",
+ order: "",
+ });
vm.detailData = res1.result;
vm.skuData = res2.result.map(i => {
i.attributeSymbolList = i.attributeSymbolList.split(',')
return i;
});
- vm.recommendedData = res3.result;
+ vm.recommendedData = res3.result.records;
+ vm.pageLoading = false;
if (
vm.detailData.productActivityVO.isActivity &&
!vm.detailData.productActivityVO.isStartActivity &&
@@ -337,7 +382,9 @@ export default {
vm.surplus = vm.getSurplus(vm.startTime, vm.endTime);
if (vm.surplus.lefttime <= 0) {
clearInterval(vm.timer);
- location.reload();
+ if (location) {
+ location?.reload();
+ }
}
}, 1000);
},
@@ -490,7 +537,7 @@ export default {
return false;
}
this.$message.success("加入购物车成功~");
- this.$store.dispatch('getCartProducts');
+ this.$store.dispatch("getCartProducts");
// this.$Router.push('/cart');
},
},
@@ -628,6 +675,15 @@ export default {
margin-right: 20px;
}
+ .msg-price {
+ font-size: 22px;
+ color: #ff512b;
+ &::before {
+ content: "¥";
+ font-size: 14px;
+ }
+ }
+
.msg-service {
font-size: 14px;
font-family: Microsoft YaHei-Regular, Microsoft YaHei;
diff --git a/pages/goods/list/index.vue b/pages/goods/list/index.vue
index c7dba3f..e36e8ad 100644
--- a/pages/goods/list/index.vue
+++ b/pages/goods/list/index.vue
@@ -7,14 +7,42 @@
-->
-
+
+