Compare commits
No commits in common. "26563409c9737e627bb9d27b1da301ad1170059c" and "a99c3884e2fa41c28577a230837bea8fee017dc1" have entirely different histories.
26563409c9
...
a99c3884e2
@ -20,12 +20,12 @@ function request(url, method = 'GET', data = {}) {
|
|||||||
header,
|
header,
|
||||||
success(res) {
|
success(res) {
|
||||||
if (res.data.code) {
|
if (res.data.code) {
|
||||||
if (res.data.code == 10103 || res.data.code == 10101) {
|
if (res.data.code == 10103 || res.data.code == 10104) {
|
||||||
wx.removeStorageSync('access_token');
|
wx.removeStorageSync('access_token');
|
||||||
// wx.navigateTo({
|
// wx.navigateTo({
|
||||||
// url: '/pages/login/index',
|
// url: '/pages/login/login',
|
||||||
// });
|
// });
|
||||||
// reject(res.data);
|
reject(res.data);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
wx.showToast({
|
wx.showToast({
|
||||||
|
|||||||
@ -216,7 +216,7 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="logout-btn" @click="logout">退出登录</view>
|
<view class="logout-btn">退出登录</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="quick-card">
|
<view class="quick-card">
|
||||||
<view class="quick-title">快捷功能</view>
|
<view class="quick-title">快捷功能</view>
|
||||||
@ -797,12 +797,6 @@ export default {
|
|||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/pages/my/editInfo/index'
|
url: '/pages/my/editInfo/index'
|
||||||
});
|
});
|
||||||
},
|
|
||||||
logout() {
|
|
||||||
wx.removeStorageSync('access_token');
|
|
||||||
uni.reLaunch({
|
|
||||||
url: '/pages/login/index'
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@ -43,7 +43,7 @@
|
|||||||
<view class="product-price">
|
<view class="product-price">
|
||||||
<text class="current-price">¥{{ formatPrice(currentPrice) }}</text>
|
<text class="current-price">¥{{ formatPrice(currentPrice) }}</text>
|
||||||
<text class="original-price" v-if="originalPrice > currentPrice">¥{{ formatPrice(originalPrice)
|
<text class="original-price" v-if="originalPrice > currentPrice">¥{{ formatPrice(originalPrice)
|
||||||
}}</text>
|
}}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="sku-hint" v-if="skuList.length > 1 && !selectedSku">
|
<view class="sku-hint" v-if="skuList.length > 1 && !selectedSku">
|
||||||
请选择规格
|
请选择规格
|
||||||
@ -147,17 +147,17 @@
|
|||||||
<view class="note-item">
|
<view class="note-item">
|
||||||
<text class="note-label">前调:</text>
|
<text class="note-label">前调:</text>
|
||||||
<text class="note-content">{{ productInfo.scent_level.top_note || '柠檬、佛手柑、粉红胡椒'
|
<text class="note-content">{{ productInfo.scent_level.top_note || '柠檬、佛手柑、粉红胡椒'
|
||||||
}}</text>
|
}}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="note-item">
|
<view class="note-item">
|
||||||
<text class="note-label">中调:</text>
|
<text class="note-label">中调:</text>
|
||||||
<text class="note-content">{{ productInfo.scent_level.middle_note || '玫瑰、茉莉、牡丹'
|
<text class="note-content">{{ productInfo.scent_level.middle_note || '玫瑰、茉莉、牡丹'
|
||||||
}}</text>
|
}}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="note-item">
|
<view class="note-item">
|
||||||
<text class="note-label">后调:</text>
|
<text class="note-label">后调:</text>
|
||||||
<text class="note-content">{{ productInfo.scent_level.base_note || '白麝香、雪松、香草'
|
<text class="note-content">{{ productInfo.scent_level.base_note || '白麝香、雪松、香草'
|
||||||
}}</text>
|
}}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -605,22 +605,11 @@ export default {
|
|||||||
|
|
||||||
// 跳转到购物车
|
// 跳转到购物车
|
||||||
goToCart() {
|
goToCart() {
|
||||||
const token = await uni.getStorageSync('access_token')
|
|
||||||
if (!token) {
|
|
||||||
uni.navigateTo({
|
|
||||||
url: '/pages/login/index'
|
|
||||||
})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/pages/shoppingCart/index'
|
url: '/pages/shoppingCart/index'
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
async fetchCartSelectedCount() {
|
async fetchCartSelectedCount() {
|
||||||
const token = await uni.getStorageSync('access_token')
|
|
||||||
if (!token) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
const res = await request('xcx/carts', 'GET', { page: 1, page_size: 99 });
|
const res = await request('xcx/carts', 'GET', { page: 1, page_size: 99 });
|
||||||
const list = res.list || res.data || res || [];
|
const list = res.list || res.data || res || [];
|
||||||
|
|||||||
@ -19,8 +19,7 @@
|
|||||||
<view class="item-price-row">
|
<view class="item-price-row">
|
||||||
<view class="item-price">
|
<view class="item-price">
|
||||||
<text class="price-symbol">¥</text>
|
<text class="price-symbol">¥</text>
|
||||||
<text class="price-value">{{ formatPrice(item.price) || formatPrice(item.sku_price)
|
<text class="price-value">{{ formatPrice(item.price) || formatPrice(item.sku_price) }}</text>
|
||||||
}}</text>
|
|
||||||
</view>
|
</view>
|
||||||
<view class="item-count">
|
<view class="item-count">
|
||||||
<view class="count-btn" @click="decreaseCount(index)">-</view>
|
<view class="count-btn" @click="decreaseCount(index)">-</view>
|
||||||
@ -102,37 +101,27 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad() {
|
onLoad() {
|
||||||
this.getUserIsLogin();
|
this.loadCartList();
|
||||||
},
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
this.getUserIsLogin();
|
// 页面显示时刷新购物车
|
||||||
|
this.loadCartList();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async getUserIsLogin() {
|
formatPrice(value) {
|
||||||
const token = await uni.getStorageSync('access_token')
|
if(!value) {
|
||||||
if (token) {
|
return 0.00;
|
||||||
// 页面显示时刷新购物车
|
}
|
||||||
this.loadCartList();
|
// 分转换为元
|
||||||
} else {
|
value = value / 100;
|
||||||
uni.navigateTo({
|
// 保留两位小数
|
||||||
url: '/pages/login/index'
|
return value.toFixed(2);
|
||||||
})
|
},
|
||||||
}
|
|
||||||
},
|
|
||||||
formatPrice(value) {
|
|
||||||
if (!value) {
|
|
||||||
return 0.00;
|
|
||||||
}
|
|
||||||
// 分转换为元
|
|
||||||
value = value / 100;
|
|
||||||
// 保留两位小数
|
|
||||||
return value.toFixed(2);
|
|
||||||
},
|
|
||||||
// 加载购物车列表
|
// 加载购物车列表
|
||||||
async loadCartList() {
|
async loadCartList() {
|
||||||
try {
|
try {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
const res = await request('xcx/carts', 'GET', { page: 1, page_size: 99 });
|
const res = await request('xcx/carts', 'GET', {page: 1, page_size: 99});
|
||||||
// 根据实际返回数据结构调整
|
// 根据实际返回数据结构调整
|
||||||
const list = res.list || res.data || res || [];
|
const list = res.list || res.data || res || [];
|
||||||
// 为每个商品添加selected属性,1表示选中,2表示不选中
|
// 为每个商品添加selected属性,1表示选中,2表示不选中
|
||||||
@ -302,7 +291,7 @@ export default {
|
|||||||
margin-bottom: 20rpx;
|
margin-bottom: 20rpx;
|
||||||
padding: 30rpx 24rpx;
|
padding: 30rpx 24rpx;
|
||||||
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.05);
|
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.05);
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
.item-checkbox {
|
.item-checkbox {
|
||||||
@ -436,9 +425,9 @@ export default {
|
|||||||
margin-left: 20rpx;
|
margin-left: 20rpx;
|
||||||
padding: 10rpx;
|
padding: 10rpx;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 20rpx;
|
top: 20rpx;
|
||||||
right: 20rpx;
|
right: 20rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.item-delete:active {
|
.item-delete:active {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user