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

10
mixins/myMixins.js

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

3
static/css/base.css

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

18
static/js/request.js

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

2
subPackages/food/detail.vue

@ -257,7 +257,7 @@
}, },
getCartList () { 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 this.cartNum = res.data || 0
}) })
}, },

2
subPackages/homestay/detail.vue

@ -244,7 +244,7 @@
methods: { methods: {
// //
getCartList () { 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 this.cartNum = res.data || 0
}) })
}, },

2
subPackages/order/orderCoupon.vue

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

2
subPackages/ticket/detail.vue

@ -517,7 +517,7 @@
// //
getCartList () { 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 this.cartNum = res.data || 0
}) })
}, },

Loading…
Cancel
Save