Browse Source

购物车不强制登录+优惠券修复

master
jiazhipeng 2 months ago
parent
commit
73678fdd2f
  1. 2
      components/cartData.vue
  2. 10
      mixins/myMixins.js
  3. 3
      static/css/base.css
  4. 10
      static/js/request.js
  5. 2
      subPackages/food/detail.vue
  6. 2
      subPackages/homestay/detail.vue
  7. 2
      subPackages/order/orderCoupon.vue
  8. 2
      subPackages/ticket/detail.vue

2
components/cartData.vue

@ -144,7 +144,7 @@
this.cartData = data
this.setAllSelect()
} else {
this.Post({},'/api/cart/get_post_list').then(res => {
this.Post({noForceLogin: true},'/api/cart/get_post_list').then(res => {
if (res) {
this.cartData = (res.data || []).map(v=>{return {...v, isSelected:selectedData.includes(v.specifications_id)}})
this.setAllSelect()

10
mixins/myMixins.js

@ -15,10 +15,10 @@ export const myMixins ={
// 分享到朋友圈
onShareTimeline() {
return {
title: '智游常熟',
title: '时味苏州',
type: 0,
summary: "edewdewdewf",
imageUrl: "https://static.ticket.sz-trip.com/dongtai/images/index/share.jpg"
imageUrl: "https://static.ticket.sz-trip.com/uploads/20250813/b31ec3969350407f4fca5c0d283d9102.png"
}
},
onShareAppMessage() {
@ -33,10 +33,10 @@ export const myMixins ={
console.log(111,url,`${view.route}?url=${url}`)
return {
title: '智游常熟', // 分享的名称
title: '时味苏州', // 分享的名称
path: `${view.route}?url=${url}`, // 将 url 作为参数传递
imageUrl: "https://static.ticket.sz-trip.com/dongtai/images/index/share.jpg",
mpId: 'wxb8f15afe2765976d' // 此处配置微信小程序的 AppId
imageUrl: "https://static.ticket.sz-trip.com/uploads/20250813/b31ec3969350407f4fca5c0d283d9102.png",
mpId: 'wx699ed131345cf8dd' // 此处配置微信小程序的 AppId
};
}
}

3
static/css/base.css

@ -89,6 +89,9 @@ view {
}
.h-1rpx{
height: 1rpx;
}
.no-scrollbar::-webkit-scrollbar{
display: none;
}
.no-data-zhanwei{
display: flex;

10
static/js/request.js

@ -20,15 +20,17 @@ const getToken = () => {
};
// 定义错误处理函数
const handleError = (res, reject) => {
const handleError = (res, reject, noForceLogin) => {
setTimeout(() => {
if (!noForceLogin) {
uni.showToast({
title: res.data?.msg || res.msg,
icon: 'none'
});
}
reject(res);
}, 0);
if (res.data?.code === 401) {
if (res.data?.code === 401 && !noForceLogin) {
store.commit('changeLoginPath');
}
};
@ -64,13 +66,13 @@ Vue.prototype.Post = (params = {}, apiurl) => {
if (res.data.code === 200 || res.data.code === 1) {
resolve(res.data);
} else {
handleError(res, reject);
handleError(res, reject,params.noForceLogin);
}
},
fail: (err) => {
console.log('err', err);
uni.hideLoading()
handleError(err, reject);
handleError(err, reject,params.noForceLogin);
}
});
});

2
subPackages/food/detail.vue

@ -257,7 +257,7 @@
},
getCartList () {
this.Post({},'/api/cart/get_cart_count').then(res=>{
this.Post({noForceLogin: true},'/api/cart/get_cart_count').then(res=>{
this.cartNum = res.data || 0
})
},

2
subPackages/homestay/detail.vue

@ -244,7 +244,7 @@
methods: {
//
getCartList () {
this.Post({},'/api/cart/get_cart_count').then(res=>{
this.Post({noForceLogin: true},'/api/cart/get_cart_count').then(res=>{
this.cartNum = res.data || 0
})
},

2
subPackages/order/orderCoupon.vue

@ -114,7 +114,7 @@
console.log('选中的',this.list[index].selected);
if(item.selected) {
if (item.activity.discount_type == 'pricebreak') {
this.reducePrice = item.activity.mini_money/100+'元'
this.reducePrice = item.activity.money/100+'元'
this.coupon = item
} else{
this.coupon = item

2
subPackages/ticket/detail.vue

@ -517,7 +517,7 @@
//
getCartList () {
this.Post({},'/api/cart/get_cart_count').then(res=>{
this.Post({noForceLogin: true},'/api/cart/get_cart_count').then(res=>{
this.cartNum = res.data || 0
})
},

Loading…
Cancel
Save