Commit 447b16d9 by songbingqi

修复部分bug

parent 8b2bdda8
...@@ -30,8 +30,7 @@ ...@@ -30,8 +30,7 @@
</view> </view>
<view class="right_bottom"> <view class="right_bottom">
<view class="more_info" @click="openDetail"> <view class="more_info" @click="openDetail">
<view :style="[descColor]"class="desc" v-if="info.couponType===1||info.couponType===2">抵扣订单金额</view> <view :style="[descColor]"class="desc">{{info.categoryDesc}}</view>
<view :style="[descColor]"class="desc" v-else>下单可抵扣商品,指定分类商品可用</view>
<image :class="['arrow-right-select',arrowFlag?'arrow-right-select-down':'arrow-right-select-up']" :src="info.status!==0?'../../static/imgs/jiantouqian.png':'../../static/imgs/jiantouhei.png'" /> <image :class="['arrow-right-select',arrowFlag?'arrow-right-select-down':'arrow-right-select-up']" :src="info.status!==0?'../../static/imgs/jiantouqian.png':'../../static/imgs/jiantouhei.png'" />
</view> </view>
</view> </view>
...@@ -82,6 +81,7 @@ export default { ...@@ -82,6 +81,7 @@ export default {
zkPrice:'7', // 折扣金额 zkPrice:'7', // 折扣金额
dkPrice:'免单', // 抵扣金额 dkPrice:'免单', // 抵扣金额
priceDesc:'满130可用', // 条件描述 priceDesc:'满130可用', // 条件描述
categoryDesc:'最大免单', // 下拉行描述
checkStatus:false, // 优惠券选中状态 checkStatus:false, // 优惠券选中状态
title:'最大字数最大字数最大', // 优惠券标题 title:'最大字数最大字数最大', // 优惠券标题
time:['2022.07.24.17:20'], // 过期时间 time:['2022.07.24.17:20'], // 过期时间
...@@ -159,7 +159,7 @@ export default { ...@@ -159,7 +159,7 @@ export default {
}, },
selected(info) { selected(info) {
if(info.status!==0)return if(info.status!==0)return
this.$emit("updata",info.id) this.$emit("updata",{id:info.id,checkStatus:info.checkStatus})
}, },
goMenu() { goMenu() {
uni.switchTab({ url: '/pages/menu/menu' }); uni.switchTab({ url: '/pages/menu/menu' });
......
...@@ -65,6 +65,7 @@ export default { ...@@ -65,6 +65,7 @@ export default {
zkPrice:'7', // 折扣金额 zkPrice:'7', // 折扣金额
dkPrice:'免单', // 抵扣金额 dkPrice:'免单', // 抵扣金额
priceDesc:'满130可用', // 条件描述 priceDesc:'满130可用', // 条件描述
categoryDesc:'最大免单', // 下拉行描述
checkStatus:false, // 优惠券选中状态 checkStatus:false, // 优惠券选中状态
title:'最大字数最大字数最大', // 优惠券标题 title:'最大字数最大字数最大', // 优惠券标题
time:['2022.07.24.17:20'], // 过期时间 time:['2022.07.24.17:20'], // 过期时间
...@@ -82,7 +83,6 @@ export default { ...@@ -82,7 +83,6 @@ export default {
async getTickList(val) { async getTickList(val) {
const {data} = await Mine.getUserList(val) const {data} = await Mine.getUserList(val)
const {rows} = data const {rows} = data
console.log(data)
const canuse = rows.map(item=>{ const canuse = rows.map(item=>{
let timeStart = '' let timeStart = ''
let timeEnd = '' let timeEnd = ''
...@@ -99,6 +99,7 @@ export default { ...@@ -99,6 +99,7 @@ export default {
typeDesc: item.categoryName, typeDesc: item.categoryName,
price: item.priceDiscount, price: item.priceDiscount,
priceDesc: item.ruleDesc, priceDesc: item.ruleDesc,
categoryDesc:item.categoryDesc,
checkStatus: false, checkStatus: false,
title: item.name, title: item.name,
time: [timeStart,timeEnd], time: [timeStart,timeEnd],
......
...@@ -103,12 +103,18 @@ export default { ...@@ -103,12 +103,18 @@ export default {
this.canuse = this.$store.state.order.tickListSettle.canuse this.canuse = this.$store.state.order.tickListSettle.canuse
}, },
methods: { methods: {
updata(id){ updata(val){
const { id, checkStatus } = val
this.canuse.map(item=>{ this.canuse.map(item=>{
if(item.id===id){ if(item.id===id){
item.checkStatus = !item.checkStatus item.checkStatus = !item.checkStatus
}else{ }else{
item.checkStatus = false item.checkStatus = false
item.status = 1
item.reson = '不可与已勾选券叠加使用'
}
if(checkStatus){
item.status = 0
} }
}) })
this.canuse = [...this.canuse] this.canuse = [...this.canuse]
......
...@@ -478,7 +478,10 @@ export default { ...@@ -478,7 +478,10 @@ export default {
} }
let orderInfo = await Menu.saveReserve(sendData); let orderInfo = await Menu.saveReserve(sendData);
if (orderInfo && orderInfo.data.code == 200) { if (orderInfo && orderInfo.data.code == 200) {
// const {}
await Menu.requestPayment(orderInfo.data.data, res, this.buyType); await Menu.requestPayment(orderInfo.data.data, res, this.buyType);
}else{
} }
} }
......
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
<view class="box" @click.stop="goToPage('coupon')"> <view class="box" @click.stop="goToPage('coupon')">
<view class="left"> <view class="left">
<view class="text">HOOLOO券</view> <view class="text">HOOLOO券</view>
<view class="tickNum" v-if="tickNum">{{tickNum}}张可用</view>
</view> </view>
<view class="right"><image class="icon" src="/static/imgs/youhuijuan.png"></image></view> <view class="right"><image class="icon" src="/static/imgs/youhuijuan.png"></image></view>
</view> </view>
...@@ -107,10 +108,15 @@ export default { ...@@ -107,10 +108,15 @@ export default {
this.img = 'https://s3.bmp.ovh/imgs/2022/07/05/1768111c5c7f5300.gif' this.img = 'https://s3.bmp.ovh/imgs/2022/07/05/1768111c5c7f5300.gif'
} }
}, },
async onShow() {
const {data} = await User.getCouponNum()
this.tickNum = data?.data||0
},
data() { data() {
return { return {
loginInfo:"", loginInfo:"",
img:'' img:'',
tickNum:0
} }
}, },
computed: { computed: {
...@@ -424,6 +430,15 @@ button::after { ...@@ -424,6 +430,15 @@ button::after {
font-weight: normal; font-weight: normal;
color: #333333; color: #333333;
} }
.tickNum {
font-size: 20rpx;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #999999;
position: absolute;
left: 40rpx;
bottom: -18rpx;
}
.desc { .desc {
font-size: 20rpx; font-size: 20rpx;
font-family: PingFangSC-Regular, PingFang SC; font-family: PingFangSC-Regular, PingFang SC;
......
...@@ -48,17 +48,36 @@ export default { ...@@ -48,17 +48,36 @@ export default {
requestPayment(data, oldData, buyType) { requestPayment(data, oldData, buyType) {
// res为调起微信支付所需参数 // res为调起微信支付所需参数
// 调起微信支付 // 调起微信支付
const { switchTab = true, callBack } = data if(data.appId) {
uni.requestPayment({ const { switchTab = true, callBack } = data
provider: 'wxpay', // 服务提提供商微信支付 uni.requestPayment({
timeStamp: data.timeStamp, // 时间戳 provider: 'wxpay', // 服务提提供商微信支付
nonceStr: data.nonceStr, // 随机字符串 timeStamp: data.timeStamp, // 时间戳
package: data.package, nonceStr: data.nonceStr, // 随机字符串
signType: data.signType || 'MD5', // 签名算法 package: data.package,
paySign: data.paySign, // 签名 signType: data.signType || 'MD5', // 签名算法
success: async function (res) { paySign: data.paySign, // 签名
if (res.errMsg == 'requestPayment:ok') { success: async function (res) {
// 删除购物车数据后重新放回购物车 if (res.errMsg == 'requestPayment:ok') {
// 删除购物车数据后重新放回购物车
uni.setStorageSync('shopCarInfo', []);
$EventBus.$emit('updateCar');
uni.setStorageSync('orderId', data.orderId);
if(switchTab){
let url = '/orderSubPackage/pages/orderInfo/index?from=settlement'
uni.navigateTo({ url })
}else{
callBack()
}
}
// 业务逻辑。。。
},
fail: async function (err) {
context.showToast({
title: '支付失败',
icon: 'error',
});
uni.setStorageSync('shopCarInfo', []); uni.setStorageSync('shopCarInfo', []);
$EventBus.$emit('updateCar'); $EventBus.$emit('updateCar');
uni.setStorageSync('orderId', data.orderId); uni.setStorageSync('orderId', data.orderId);
...@@ -68,26 +87,14 @@ export default { ...@@ -68,26 +87,14 @@ export default {
}else{ }else{
callBack() callBack()
} }
} },
});
}else{
uni.setStorageSync('orderId', data);
let url = '/orderSubPackage/pages/orderInfo/index?from=settlement'
uni.navigateTo({ url })
}
// 业务逻辑。。。
},
fail: async function (err) {
context.showToast({
title: '支付失败',
icon: 'error',
});
uni.setStorageSync('shopCarInfo', []);
$EventBus.$emit('updateCar');
uni.setStorageSync('orderId', data.orderId);
if(switchTab){
let url = '/orderSubPackage/pages/orderInfo/index?from=settlement'
uni.navigateTo({ url })
}else{
callBack()
}
},
});
}, },
// 优惠卷信息接口 // 优惠卷信息接口
requestTicketList(data){ requestTicketList(data){
......
...@@ -181,5 +181,19 @@ export default { ...@@ -181,5 +181,19 @@ export default {
context.showToast({ title: msg, icon: 'none' }); context.showToast({ title: msg, icon: 'none' });
return err return err
}); });
},
// 获取用户优惠券数量
getCouponNum(params) {
return uni.$u.http
.get('/app/homepage/coupon-count')
.then((res) => {
return res;
})
.catch((err) => {
const {data} = err
const {msg} = data
context.showToast({ title: msg, icon: 'none' });
return err
});
} }
}; };
...@@ -17,18 +17,19 @@ const order = { ...@@ -17,18 +17,19 @@ const order = {
let timeStart = '' let timeStart = ''
let timeEnd = '' let timeEnd = ''
if(item.useStartTime){ if(item.useStartTime){
timeStart = item.useStartTime.slice(0,11).replace('-', '.') timeStart = item.useStartTime.slice(0,11).replace(new RegExp('-','g'), '.')
} }
if(item.useEndTime){ if(item.useEndTime){
timeEnd = item.useEndTime.slice(0,11).replace('-', '.') timeEnd = item.useEndTime.slice(0,11).replace(new RegExp('-','g'), '.')
} }
return { return {
id: item.id, id: item.id,
status: 0, status: 0,
couponType: item.type, couponType: item.type,
typeDesc: item.categoryName, typeDesc: item.categoryName,
price: item.priceDiscount, price: item.priceDiscount===0?'免单':item.priceDiscount,
priceDesc: item.ruleDesc, priceDesc: item.ruleDesc,
categoryDesc:item.categoryDesc,
checkStatus: false, checkStatus: false,
title: item.name, title: item.name,
time: [timeStart,timeEnd], time: [timeStart,timeEnd],
...@@ -44,23 +45,33 @@ const order = { ...@@ -44,23 +45,33 @@ const order = {
}).sort((a,b)=>{ }).sort((a,b)=>{
return b.couponAmount - a.couponAmount return b.couponAmount - a.couponAmount
}) })
for(let i=0;i<canuse.length;i++){
if(i===0){
canuse[i].checkStatus = true
} else {
canuse[i].checkStatus = false
canuse[i].status = 1
canuse[i].reson = '不可与已勾选券叠加使用'
}
}
if(canuse.length!=0)canuse[0].checkStatus = true if(canuse.length!=0)canuse[0].checkStatus = true
const cantUse = data.notfitable.map(item=>{ const cantUse = data.notfitable.map(item=>{
let timeStart = '' let timeStart = ''
let timeEnd = '' let timeEnd = ''
if(item.useStartTime){ if(item.useStartTime){
timeStart = item.useStartTime.slice(0,11).replace('-', '.') timeStart = item.useStartTime.slice(0,11).replace(new RegExp('-','g'), '.')
} }
if(item.useEndTime){ if(item.useEndTime){
timeEnd = item.useEndTime.slice(0,11).replace('-', '.') timeEnd = item.useEndTime.slice(0,11).replace(new RegExp('-','g'), '.')
} }
return { return {
id: item.id, id: item.id,
status: 1, status: 1,
couponType: item.type, couponType: item.type,
typeDesc: item.categoryName, typeDesc: item.categoryName,
price: item.priceDiscount, price: item.priceDiscount===0?'免单':item.priceDiscount,
priceDesc: item.ruleDesc, priceDesc: item.ruleDesc,
categoryDesc:item.categoryDesc,
checkStatus: false, checkStatus: false,
title: item.name, title: item.name,
time: [timeStart,timeEnd], time: [timeStart,timeEnd],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment