diff --git a/public/img/nocart.png b/public/img/nocart.png
new file mode 100644
index 0000000..611a5b5
Binary files /dev/null and b/public/img/nocart.png differ
diff --git a/src/App.vue b/src/App.vue
index 554e8d3..7acf551 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -1,7 +1,7 @@
-
+
@@ -15,17 +15,32 @@ export default {
return routes.filter(r => r.meta.cache).map(r => r.name)
}
},
+ data() {
+ return {
+ wechatShareInfo: {}
+ }
+ },
watch: {
$route(to, from) {
const title = to.meta.title || ''
this.updateTitle(title)
+ this.updateShare(undefined, undefined, undefined)
}
},
+ mounted() {
+ this.init()
+ },
methods: {
+ init() {
+ this.$post('/v1/client/HWxinfoClient/share', { url: location.href }).then(data => {
+ this.wechatShareInfo = data
+ }).finally(() => {
+ this.updateShare()
+ })
+ },
updateTitle(title) {
document.title = title
if (this.$isWechat()) {
- // 微信安卓需要用 iframe 触发标题更新
const iframe = document.createElement('iframe')
iframe.style.display = 'none'
iframe.src = 'https://www.baidu.com/favicon.ico?' + Date.now()
@@ -39,32 +54,34 @@ export default {
},
updateShare(title, desc, imgUrl) {
if (wx && this.$isWechat()) {
- // this.$CommonAPI.Post('GetJSSDKConfig', location.href).then(data => {
- let shareinfo = {
- title: title || '泰古润' || this.wechatShareInfo.ShareTitle,
- desc: desc || '汇聚平凡梦想,共创美好未来' || this.wechatShareInfo.ShareContent,
- imgUrl: this.$file(imgUrl || this.wechatShareInfo.ShareLogo),
- link: this.$getShareLink(),
- };
- if (this.$isWechatMini())
- wx.miniProgram.postMessage({ data: { share: shareinfo } });
- data.jsApiList.push('wx-open-launch-weapp');
- data.openTagList = ['wx-open-launch-weapp'];
- wx.config(data);
- wx.ready(() => {
- wx.updateAppMessageShareData(shareinfo);
- wx.updateTimelineShareData(shareinfo);
- if (location.hash == '#/Weapp') {
- document.addEventListener('WeixinOpenTagsError', function (e) {
- alert(e.detail.errMsg); // 无法使用开放标签的错误原因,需回退兼容。仅无法使用开放标签,JS-SDK其他功能不受影响
- });
- }
+ this.$post('/v1/client/HWxinfoClient/share', { url: location.href }).then(data => {
+ let shareinfo = {
+ title: title || this.wechatShareInfo.ShareTitle || '泰古润',
+ desc: desc || this.wechatShareInfo.ShareContent || '汇聚平凡梦想,共创美好未来',
+ imgUrl: this.$file(imgUrl || this.wechatShareInfo.ShareLogo || '/img/logo.png'),
+ link: this.$getShareLink(),
+ };
+ if (this.$isWechatMini())
+ wx.miniProgram.postMessage({ data: { share: shareinfo } });
+ data.jsApiList.push('wx-open-launch-weapp');
+ data.openTagList = ['wx-open-launch-weapp'];
+ wx.config({
+ debug: false,
+ appId: data.appid,
+ timestamp: data.timestamp,
+ nonceStr: data.noncestr,
+ signature: data.signature,
+ jsApiList: data.jsApiList,
+ openTagList: data.openTagList
+ });
+ wx.ready(() => {
+ wx.updateAppMessageShareData(shareinfo);
+ wx.updateTimelineShareData(shareinfo);
+ });
+ wx.error((e) => {
+ console.error('wx.error', e);
+ });
});
- wx.error((e) => {
- if (location.hash == '#/Weapp')
- alert(JSON.stringify(e));
- });
- // });
}
},
}
diff --git a/src/router.js b/src/router.js
index 1616b40..1a445bc 100644
--- a/src/router.js
+++ b/src/router.js
@@ -178,7 +178,7 @@ const routes = [
path: '/TradeList',
name: 'TradeList',
component: () => import('./views/Trade/TradeList.vue'),
- meta: { title: '订单列表' }
+ meta: { title: '订单列表', cache: true }
},
{
path: '/Pay',
diff --git a/src/styles/public.less b/src/styles/public.less
index 8ecf433..545f048 100644
--- a/src/styles/public.less
+++ b/src/styles/public.less
@@ -780,7 +780,7 @@ img {
.van-tab {
height: 10.13vw;
background-color: #ededed;
- font-size: 4vw;
+ font-size: 3.67vw;
}
.van-tab--active {
@@ -2239,6 +2239,12 @@ img {
color: #303030;
white-space: nowrap;
+ .overhide {
+ width: 70vw;
+ overflow: hidden;
+ .text-hide(1);
+ }
+
img {
width: 3.73vw;
height: 2.93vw;
diff --git a/src/views/Goods/GoodsDetail.vue b/src/views/Goods/GoodsDetail.vue
index a9e8b14..147675f 100644
--- a/src/views/Goods/GoodsDetail.vue
+++ b/src/views/Goods/GoodsDetail.vue
@@ -1,5 +1,5 @@
-
+
![]()
@@ -62,7 +62,7 @@
-

+
不支持发货区域:
@@ -73,7 +73,7 @@

-
{{ selectedSku }}
+
{{ selectedSku }}
@@ -263,16 +263,25 @@ export default {
if (mainSku) {
this.tempSku = { ...mainSku, Qty: 1 };
this.selectedSku = "已选:" + mainSku.skuname;
- // 根据skuname设置默认选中规格,拆分规格名匹配对应分类
- const skuParts = mainSku.skuname.split('-').filter(Boolean);
- this.specSelect.forEach((spec, specIndex) => {
+ // 根据skuname设置默认选中规格,skuname用逗号分隔
+ const skuParts = mainSku.skuname.split(',').filter(Boolean);
+ this.specSelect.forEach((spec) => {
+ const specIndex = this.specSelect.findIndex(s => s.name === spec.name);
+ // 优先从skuname匹配,匹配不到则默认选中第一个子选项
if (skuParts[specIndex]) {
const child = spec.children?.find(c => skuParts[specIndex].includes(c.name));
if (child) {
this.selectedSpecs[spec.name] = child.name;
+ } else if (spec.children?.length > 0) {
+ this.selectedSpecs[spec.name] = spec.children[0].name;
}
+ } else if (spec.children?.length > 0) {
+ // skuname没有对应分类时,默认选中第一个
+ this.selectedSpecs[spec.name] = spec.children[0].name;
}
});
+ // 调用refreshSku确保tempSku包含正确的skuid等信息
+ this.refreshSku();
}
},
selectSpec(specName, specValue) {
@@ -284,9 +293,10 @@ export default {
if (specKeys.length === 0) return;
let matchedSku = this.specCombinations.find(combo => {
- const skuParts = combo.skuname.split('-').filter(Boolean);
- return specKeys.every((key, specIndex) => {
+ const skuParts = combo.skuname.split(',').filter(Boolean);
+ return specKeys.every((key) => {
const selectedVal = this.selectedSpecs[key];
+ const specIndex = this.specSelect.findIndex(s => s.name === key);
return skuParts[specIndex]?.includes(selectedVal);
});
});
@@ -331,7 +341,7 @@ export default {
this.$showFailToast("该规格库存不足,无法购买");
return;
}
- this.$navigate(`/TradeConfirm?id=${this.data.id}&skuid=${this.tempSku.skuid}&buynums=${this.tempSku.Qty}`);
+ this.$navigate(`/TradeConfirm?id=${this.data.id}&skuname=${encodeURIComponent(this.tempSku.skuname)}&buynums=${this.tempSku.Qty}`);
},
beforeShare() {
this.showShare = true;
diff --git a/src/views/Trade/TradeConfirm.vue b/src/views/Trade/TradeConfirm.vue
index 2edf7d1..19dfebb 100644
--- a/src/views/Trade/TradeConfirm.vue
+++ b/src/views/Trade/TradeConfirm.vue
@@ -191,13 +191,13 @@ export default {
methods: {
loadProduct() {
const id = this.$route.query.id;
- const skuid = this.$route.query.skuid;
+ const skuname = decodeURIComponent(this.$route.query.skuname || '');
this.$get(`/v1/client/EProsClient/${id}`).then(res => {
const data = res.data;
// 从规格组合中找到匹配的SKU
let sku = null;
- if (skuid && data.specCombinations) {
- sku = data.specCombinations.find(s => String(s.skuid) === String(skuid));
+ if (skuname && data.specCombinations) {
+ sku = data.specCombinations.find(s => s.skuname === skuname);
}
if (!sku && data.specCombinations?.length) {
sku = data.specCombinations[0];
@@ -209,7 +209,7 @@ export default {
saleprice: sku?.saleprice || data.saleprice,
originalprice: sku?.originalprice || data.originalprice,
skuid: sku?.skuid,
- skuname: sku?.skuname || '默认规格',
+ skuname: sku?.skuname || skuname || '默认规格',
buynums: parseInt(this.$route.query.buynums) || 1,
typename: data.typename || '商品',
expressprice: data.expressprice || 0,
diff --git a/src/views/Trade/TradeDetail.vue b/src/views/Trade/TradeDetail.vue
index cb8cb7f..a2f263f 100644
--- a/src/views/Trade/TradeDetail.vue
+++ b/src/views/Trade/TradeDetail.vue
@@ -132,7 +132,7 @@ export default {
},
methods: {
back() {
- this.$navigate('/TradeList');
+ window.history.back();
},
async loadData() {
try {
diff --git a/src/views/Trade/Tradelist.vue b/src/views/Trade/Tradelist.vue
index 170ec45..23e0944 100644
--- a/src/views/Trade/Tradelist.vue
+++ b/src/views/Trade/Tradelist.vue
@@ -130,7 +130,11 @@ export default {
{
"value": 4,
"label": "买单订单"
- }
+ },
+ {
+ "value": 5,
+ "label": "积分订单"
+ },
],
_initializing: true,
logisticsVisible: false,
@@ -222,7 +226,7 @@ export default {
this.$showSuccessToast('确认收货成功')
this.$refs.baseList?.refresh()
})
- .catch(err => this.$showFailToast(err.message || '操作失败'))
+ .catch()
},
// 取消订单
@@ -233,7 +237,7 @@ export default {
this.$showSuccessToast('取消订单成功')
this.$refs.baseList?.refresh()
})
- .catch(err => this.$showFailToast(err.message || '取消失败'))
+ .catch()
},
// 显示物流信息