[下单微信支付处理及首页隐藏优惠券和更多]

This commit is contained in:
2021-10-27 17:31:29 +08:00
parent e4b1f33c6c
commit 58ec38837a
3 changed files with 159 additions and 169 deletions

View File

@@ -106,11 +106,12 @@
</view> </view>
<!-- 分类 --> <!-- 分类 -->
<view class="classify"> <view class="classify">
<view class="classify-item" v-for="(item, index) in classify" :key="index" @click="onClassify(item.category_id)"> <view class="classify-item" v-for="(item, index) in classify" :key="index"
@click="onClassify(item.category_id)">
<image class="cover" :src="item.cover" mode="aspectFill"></image> <image class="cover" :src="item.cover" mode="aspectFill"></image>
<view class="title">{{item.name}}</view> <view class="title">{{item.name}}</view>
</view> </view>
<view class="classify-item" @click="onClassify('')"> <view class="classify-item" @click="onClassify('')">
<image class="cover" src="../../static/icons/equity_nav.png" mode="aspectFill"></image> <image class="cover" src="../../static/icons/equity_nav.png" mode="aspectFill"></image>
<view class="title">查看全部</view> <view class="title">查看全部</view>
</view> </view>
@@ -137,13 +138,13 @@
</view> </view>
</view> </view>
<!-- 优惠券 --> <!-- 优惠券 -->
<view class="block-title"> <!-- <view class="block-title">
<view class="title"> <view class="title">
限时抢购<text>海量商家优惠券</text> 限时抢购<text>海量商家优惠券</text>
</view> </view>
<view class="more" @click="onCoupons('more')">查看更多</view> <view class="more" @click="onCoupons('more')">查看更多</view>
</view> </view> -->
<view class="coupons" v-if="coupons.length > 0"> <view class="coupons" v-if="coupons.length < 0">
<view class="coupons-item" v-for="(item, index) in coupons" :key="index"> <view class="coupons-item" v-for="(item, index) in coupons" :key="index">
<view class="content"> <view class="content">
<view class="coupons-title"> <view class="coupons-title">
@@ -169,6 +170,11 @@
@click="onCoupons('get', item.coupon_id, index)">{{item.can.get ? '立即领取' : '已领取'}}</button> @click="onCoupons('get', item.coupon_id, index)">{{item.can.get ? '立即领取' : '已领取'}}</button>
</view> </view>
</view> </view>
<view class="block-title">
<view class="title">
优选商品<text>海量商家商品优选</text>
</view>
</view>
<!-- 优选商品 --> <!-- 优选商品 -->
<goods-list :list="goods" priceType="CNY" @on-goods="onGoods" /> <goods-list :list="goods" priceType="CNY" @on-goods="onGoods" />
<!-- 分页 --> <!-- 分页 -->
@@ -258,7 +264,7 @@
// } // }
// }) // })
uni.navigateTo({ uni.navigateTo({
url:'/pages/equity/search?type='+this.tabIndex +'' url: '/pages/equity/search?type=' + this.tabIndex + ''
}) })
break break
} }
@@ -374,7 +380,7 @@
// name: 'goodsList' // name: 'goodsList'
// }) // })
uni.navigateTo({ uni.navigateTo({
url:`/pages/goods/lists?type=id&id=${id}` url: `/pages/goods/lists?type=id&id=${id}`
}) })
}, },
// 打开微信小程序 // 打开微信小程序

View File

@@ -48,7 +48,7 @@
<u-icon v-if="selectTypeId!== '2'" name="checkmark-circle" color="#f7f7f7" size="50"></u-icon> <u-icon v-if="selectTypeId!== '2'" name="checkmark-circle" color="#f7f7f7" size="50"></u-icon>
<u-icon v-else name="checkmark-circle-fill" color="#8b64fd" size="50"></u-icon> <u-icon v-else name="checkmark-circle-fill" color="#8b64fd" size="50"></u-icon>
</view> </view>
<!-- <view class="pay-select-item" @click="selectPay('1')"> <!-- <view class="pay-select-item" @click="selectPay('1')">
<view class="pay-left"> <view class="pay-left">
<u-icon class="wx-icon" name="integral-fill" color="#fff" size="40"></u-icon> <u-icon class="wx-icon" name="integral-fill" color="#fff" size="40"></u-icon>
<view class="pay-wx-title"> <view class="pay-wx-title">
@@ -148,12 +148,6 @@
this.coupon_price = res.coupon_price this.coupon_price = res.coupon_price
} else { } else {
this.order_no = res.order_no this.order_no = res.order_no
// this.$refs.uToast.show({
// title: '下单成功',
// duration: 1888,
// type: 'primary',
// })
this.nowPay() this.nowPay()
} }
}).catch(err => { }).catch(err => {
@@ -169,7 +163,7 @@
let params = this.params let params = this.params
params.coupon_grant_id = this.coupon_grant_id params.coupon_grant_id = this.coupon_grant_id
params.remark = this.remark params.remark = this.remark
params.channel = 'mini' params.channel = 'app'
this.mallBuyGoods(params, 'post') this.mallBuyGoods(params, 'post')
}, },
// 触发支付 // 触发支付
@@ -191,70 +185,47 @@
} }
apiUrl(data).then(res => { apiUrl(data).then(res => {
if (this.selectTypeId === '2') { if (this.selectTypeId === '2') {
console.log(typeof res)
if (typeof res === 'string') { if (typeof res === 'string') {
let payInfo = JSON.parse(res) let payInfo = JSON.parse(res)
uni.requestPayment({
provider: "wxpay",
// app 支付未完。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。 orderInfo: payInfo,
// uni.requestPayment({ success: res => {
// provider: "wxpay", uni.showToast({
// orderInfo: JSON.stringify(payInfo), title: '支付成功',
// success: res => { duration: 3000,
// this.$refs.uToast.show({ mask: true,
// title: '支付成功', icon: 'none'
// type: 'primary', })
// duration: 3000
// })
// setTimeout(() => {
// this.canPay = true
// uni.reLaunch({
// url: '/pages/goods/payStatus?success=true'
// })
// }, 3000);
// },
// fail: (err) => {
// this.canPay = true
// this.$refs.uToast.show({
// title: '支付失败',
// type: 'primary',
// duration: 3000
// })
// setTimeout(() => {
// this.canPay = true
// uni.reLaunch({
// url: '/pages/goods/payStatus?success=false'
// })
// }, 3000);
// }
// })
this.$refs.uToast.show({
title: '支付失败',
type: 'primary',
duration: 3000
})
uni.showModal({
title: '温馨提醒',
content: '微信支付当前暂未开通,无法支付。',
success(res) {
this.canPay = true
setTimeout(() => { setTimeout(() => {
uni.reLaunch({
url: '/pages/goods/payStatus?success=true'
})
this.canPay = true this.canPay = true
}, 3000);
},
fail: (err) => {
console.log('payerr', err)
uni.showToast({
title: '支付失败',
duration: 3000,
mask: true,
icon: 'none'
})
setTimeout(() => {
uni.reLaunch({ uni.reLaunch({
url: '/pages/goods/payStatus?success=false' url: '/pages/goods/payStatus?success=false'
}) })
this.canPay = true
}, 3000); }, 3000);
} }
}) })
// app 支付未完。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。
} else { } else {
this.$refs.uToast.show({ uni.showToast({
title: '创建订单成功', title: '创建订单成功',
type: 'primary', duration: 3000,
duration: 3000 mask: true,
icon: 'none'
}) })
setTimeout(() => { setTimeout(() => {
this.canPay = true this.canPay = true
@@ -263,25 +234,13 @@
}) })
}, 3000); }, 3000);
} }
} else {
console.log(res)
this.$refs.uToast.show({
title: res,
type: 'primary',
duration: 3000
})
setTimeout(() => {
this.canPay = true
uni.reLaunch({
url: '/pages/goods/payStatus?success=true'
})
}, 3000);
} }
}).catch(err => { }).catch(err => {
this.$refs.uToast.show({ uni.showToast({
title: err.message, title: err.message,
type: 'primary', duration: 3000,
duration: 3000 mask: true,
icon: 'none'
}) })
setTimeout(res => { setTimeout(res => {
this.canPay = true this.canPay = true

View File

@@ -4,16 +4,23 @@
<view class="canBack" v-if="canForm"></view> <view class="canBack" v-if="canForm"></view>
<view class="canPop" v-if="canForm"> <view class="canPop" v-if="canForm">
<block v-if="voucher"> <block v-if="voucher">
<image class="canPop-tips" @click="canClick" src="/static/user/order-cancelPay.png" mode="widthFix"></image> <image class="canPop-tips" @click="canClick" src="/static/user/order-cancelPay.png" mode="widthFix">
</image>
<view class="canPop-cont">打款凭证</view> <view class="canPop-cont">打款凭证</view>
<image class="canPop-cover" v-if="voucher.status.value === 3" :src="canFromImg.showpath || require('@/static/icons/add-icon.png')" @click="updImg()" mode="aspectFill" /> <image class="canPop-cover" v-if="voucher.status.value === 3"
<image class="canPop-cover" v-else :src="canFromImg.showpath || require('@/static/icons/add-icon.png')" @click="preImg()" mode="aspectFill" /> :src="canFromImg.showpath || require('@/static/icons/add-icon.png')" @click="updImg()"
mode="aspectFill" />
<image class="canPop-cover" v-else :src="canFromImg.showpath || require('@/static/icons/add-icon.png')"
@click="preImg()" mode="aspectFill" />
<view class="canPop-status">状态{{voucher.status.text}}</view> <view class="canPop-status">状态{{voucher.status.text}}</view>
<view class="canPop-remark" v-if="voucher.remark && voucher.status.value === 3">驳回原因{{voucher.remark}}</view> <view class="canPop-remark" v-if="voucher.remark && voucher.status.value === 3">驳回原因{{voucher.remark}}
<view class="canPop-btn" v-if="voucher.status.value === 3" @click="canSubmitEdit(voucher.voucher_id)">重新提交</view> </view>
<view class="canPop-btn" v-if="voucher.status.value === 3" @click="canSubmitEdit(voucher.voucher_id)">
重新提交</view>
</block> </block>
<block v-else> <block v-else>
<image class="canPop-tips" @click="canClick" src="/static/user/order-cancelPay.png" mode="widthFix"></image> <image class="canPop-tips" @click="canClick" src="/static/user/order-cancelPay.png" mode="widthFix">
</image>
<view class="canPop-cont">上传打款凭证</view> <view class="canPop-cont">上传打款凭证</view>
<image class="canPop-cover" :src="canFromImg.showpath || require('@/static/icons/add-icon.png')" <image class="canPop-cover" :src="canFromImg.showpath || require('@/static/icons/add-icon.png')"
@click="updImg()" mode="aspectFill"></image> @click="updImg()" mode="aspectFill"></image>
@@ -34,8 +41,10 @@
src="../../static/user/vip_privilege_03.png" mode="widthFix"></image> src="../../static/user/vip_privilege_03.png" mode="widthFix"></image>
</view> </view>
<view class="vip-number" v-if="item.count"> <view class="vip-number" v-if="item.count">
{{ item.count.stock > 0 ? '剩余名额:' + item.count.residue : '不限名数' }}</view> {{ item.count.stock > 0 ? '剩余名额:' + item.count.residue : '不限名数' }}
<view class="currentInfo" v-if="currentInfo.identity.identity_id === item.identity_id">当前身份</view> </view>
<view class="currentInfo" v-if="currentInfo.identity.identity_id === item.identity_id">当前身份
</view>
<view class="vip-tips"> <view class="vip-tips">
<!-- 会员 --> <!-- 会员 -->
<view v-if="item.identity_id == 2" class="vip-tips-text vip-tips-color-01">{{ item.title }} <view v-if="item.identity_id == 2" class="vip-tips-text vip-tips-color-01">{{ item.title }}
@@ -43,15 +52,18 @@
<!-- VIP节点 --> <!-- VIP节点 -->
<view v-else-if="item.identity_id == 3" class="vip-tips-text vip-tips-color-02"> <view v-else-if="item.identity_id == 3" class="vip-tips-text vip-tips-color-02">
{{ item.title }}</view> {{ item.title }}
</view>
<!-- 主节点 --> <!-- 主节点 -->
<view v-else-if="item.identity_id == 4" class="vip-tips-text vip-tips-color-03"> <view v-else-if="item.identity_id == 4" class="vip-tips-text vip-tips-color-03">
{{ item.title }}</view> {{ item.title }}
</view>
<!-- 超级节点 --> <!-- 超级节点 -->
<view v-else-if="item.identity_id == 5" class="vip-tips-text vip-tips-color-04"> <view v-else-if="item.identity_id == 5" class="vip-tips-text vip-tips-color-04">
{{ item.title }}</view> {{ item.title }}
</view>
</view> </view>
</view> </view>
</view> </view>
@@ -74,16 +86,19 @@
<block v-if="openCondition.energy_shard"> <block v-if="openCondition.energy_shard">
<view class="privilege-label" :class="{ active: openCondition.energy_shard.finish }"> <view class="privilege-label" :class="{ active: openCondition.energy_shard.finish }">
{{ openCondition.energy_shard.message }} {{ openCondition.energy_shard.message }}
<uni-icons v-if="openCondition.energy_shard.finish" type="checkmarkempty" size="17" color="#f6b338"></uni-icons> <uni-icons v-if="openCondition.energy_shard.finish" type="checkmarkempty" size="17"
color="#f6b338"></uni-icons>
</view> </view>
<view class="privilege-label" :class="{ active: openCondition.price.finish }" v-if="!openCondition.energy_shard.finish"> <view class="privilege-label" :class="{ active: openCondition.price.finish }"
v-if="!openCondition.energy_shard.finish">
{{ openCondition.price.message }} {{ openCondition.price.message }}
</view> </view>
<view class="privilege-label" v-else>{{ openCondition.service_charge.message }}</view> <view class="privilege-label" v-else>{{ openCondition.service_charge.message }}</view>
</block> </block>
<block v-else> <block v-else>
<view class="privilege-label" v-if="openCondition.certification" <view class="privilege-label" v-if="openCondition.certification"
:class="{ active: openCondition.certification.finish }">{{ openCondition.certification.message }}</view> :class="{ active: openCondition.certification.finish }">
{{ openCondition.certification.message }}</view>
</block> </block>
</view> </view>
</view> </view>
@@ -108,9 +123,12 @@
</view> </view>
<!-- 开通按钮 --> <!-- 开通按钮 -->
<view class="footer" > <view class="footer">
<image class="footer-btn" v-if="identitie[tabsIndex].can.show_button && voucher === ''" :src="identitie[tabsIndex].button_cover" mode="widthFix" @click="openOrder" /> <image class="footer-btn" v-if="identitie[tabsIndex].can.show_button && voucher === ''"
<view class="current-btn-sh" v-if="identitie[tabsIndex].can.show_button && voucher !== ''" @click="openOrder" >{{voucher.status.value === 1?'申请审核中':''}}{{voucher.status.value === 3?'申请被驳回查看原因':''}}</view> :src="identitie[tabsIndex].button_cover" mode="widthFix" @click="openOrder" />
<view class="current-btn-sh" v-if="identitie[tabsIndex].can.show_button && voucher !== ''"
@click="openOrder">
{{voucher.status.value === 1?'申请审核中':''}}{{voucher.status.value === 3?'申请被驳回查看原因':''}}</view>
<!-- <view class="current-btn-sh" v-if="!identitie[tabsIndex].can.show_button && voucher === ''">已开通</view> --> <!-- <view class="current-btn-sh" v-if="!identitie[tabsIndex].can.show_button && voucher === ''">已开通</view> -->
<view class="ios-bottom"></view> <view class="ios-bottom"></view>
</view> </view>
@@ -152,7 +170,7 @@
path: '' path: ''
}, },
openCondition: {}, openCondition: {},
voucher:'', //弹窗展示得内容 voucher: '', //弹窗展示得内容
} }
}, },
created() { created() {
@@ -177,11 +195,12 @@
}); });
this.identitie = res.identities this.identitie = res.identities
if (type === 'cre') { if (type === 'cre') {
let Index = res.identities.findIndex(val => val.identity_id == this.$Route.query.identity_id) let Index = res.identities.findIndex(val => val.identity_id == this.$Route.query
if(Index+1 === res.identities.length){ .identity_id)
if (Index + 1 === res.identities.length) {
this.tabsIndex = Index this.tabsIndex = Index
}else{ } else {
this.tabsIndex = Index+1 this.tabsIndex = Index + 1
} }
} }
this.openCondition = res.identities[this.tabsIndex].obj_condition this.openCondition = res.identities[this.tabsIndex].obj_condition
@@ -190,13 +209,14 @@
this.canBtn = res.identities[this.tabsIndex].can this.canBtn = res.identities[this.tabsIndex].can
this.currentInfo = res.user this.currentInfo = res.user
this.loding = false this.loding = false
this.voucher = this.identitie[this.tabsIndex].voucher?this.identitie[this.tabsIndex].voucher:'' this.voucher = this.identitie[this.tabsIndex].voucher ? this.identitie[this.tabsIndex]
if(this.voucher){ .voucher : ''
if (this.voucher) {
this.canFromImg = this.identitie[this.tabsIndex].voucher.cover this.canFromImg = this.identitie[this.tabsIndex].voucher.cover
}else{ } else {
this.canFromImg = { this.canFromImg = {
path:'', path: '',
showpath:'' showpath: ''
} }
} }
}).catch(err => { }).catch(err => {
@@ -231,51 +251,53 @@
} }
}, },
// 支付创建订单APP // 支付创建订单APP
wxPayAppConfig(){ wxPayAppConfig() {
let identity = this.identitie[this.tabsIndex].identity_id let identity = this.identitie[this.tabsIndex].identity_id
vipOrder(identity,{ vipOrder(identity, {
year:1, year: 1,
}).then(res=>{ }).then(res => {
this.wechatAppPay(res.id) this.wechatAppPay(res.id)
}).catch(err=>{ }).catch(err => {
uni.showToast({ uni.showToast({
title:err.message, title: err.message,
icon:"none" icon: "none"
}) })
}) })
}, },
// 微信支付 APP // 微信支付 APP
wechatAppPay(orderId){ wechatAppPay(orderId) {
vipWechatPay(orderId,{ vipWechatPay(orderId, {
type: 'app' type: 'app'
}).then(res=>{ }).then(res => {
let payConfig = JSON.parse(res) let payConfig = JSON.parse(res)
console.log(payConfig,'console.log(res)') console.log(payConfig, 'console.log(res)')
uni.requestPayment({ uni.requestPayment({
provider: 'wxpay', provider: 'wxpay',
orderInfo: {...payConfig}, orderInfo: {
...payConfig
},
success: payRes => { success: payRes => {
uni.showModal({ uni.showModal({
title : "开通提示", title: "开通提示",
content : "支付成功,已成功开通/升级节点身份", content: "支付成功,已成功开通/升级节点身份",
showCancel : false, showCancel: false,
success : ()=> { success: () => {
this.idenInfo() this.idenInfo()
} }
}) })
}, },
fail: payErr => { fail: payErr => {
console.log(payErr,'console.log(payErr)') console.log(payErr, 'console.log(payErr)')
uni.showToast({ uni.showToast({
title: '支付失败,原因:' + payErr.errMsg, title: '支付失败',
icon : 'none' icon: 'none'
}) })
} }
}) })
}).catch(err=>{ }).catch(err => {
uni.showToast({ uni.showToast({
title:err.message, title: err.message,
icon:"none" icon: "none"
}) })
}) })
}, },
@@ -315,10 +337,10 @@
}) })
}, },
// 预览图片 // 预览图片
preImg(){ preImg() {
uni.previewImage({ uni.previewImage({
current:this.voucher.cover.showpath, current: this.voucher.cover.showpath,
urls:[this.voucher.cover.showpath] urls: [this.voucher.cover.showpath]
}) })
}, },
@@ -347,9 +369,9 @@
}) })
}, },
// 编辑凭证 // 编辑凭证
canSubmitEdit(id){ canSubmitEdit(id) {
let newCover = this.canFromImg.path let newCover = this.canFromImg.path
vipVoucherUpdate(id,{ vipVoucherUpdate(id, {
cover: newCover cover: newCover
}).then(res => { }).then(res => {
this.$Router.push({ this.$Router.push({
@@ -415,11 +437,12 @@
height: 240rpx; height: 240rpx;
border: 2rpx solid #f3f3f3; border: 2rpx solid #f3f3f3;
} }
.canPop-remark{
.canPop-remark {
margin-bottom: 20rpx; margin-bottom: 20rpx;
} }
.canPop-status{ .canPop-status {
margin-bottom: 10rpx; margin-bottom: 10rpx;
} }
@@ -632,7 +655,8 @@
.footer-btn { .footer-btn {
width: 74%; width: 74%;
} }
.current-btn{
.current-btn {
width: 74%; width: 74%;
height: 80rpx; height: 80rpx;
background-image: linear-gradient(to right, #7c52fc, #976dff); background-image: linear-gradient(to right, #7c52fc, #976dff);
@@ -642,7 +666,8 @@
line-height: 80rpx; line-height: 80rpx;
font-size: 36rpx; font-size: 36rpx;
} }
.current-btn-sh{
.current-btn-sh {
background-color: #cacaca; background-color: #cacaca;
width: 74%; width: 74%;
height: 80rpx; height: 80rpx;