|
@@ -183,7 +183,19 @@
|
|
|
console.log('goodsAddView',err.data);
|
|
|
})
|
|
|
},
|
|
|
- addCart(id,buyNow){
|
|
|
+ async addCart(id,buyNow){
|
|
|
+ try {
|
|
|
+ let authResult = await this.checkAuth();
|
|
|
+ console.log('实名认证结果:', authResult);
|
|
|
+ // 在此处可以继续执行需要进行实名认证的业务逻辑
|
|
|
+ // 例如下单购买商品等操作
|
|
|
+ } catch (err) {
|
|
|
+ console.log('实名认证未通过:', err);
|
|
|
+ return
|
|
|
+ // 在此处可以处理用户未通过实名认证的情况
|
|
|
+ // 例如返回上一页或者跳转到实名认证页等操作
|
|
|
+ }
|
|
|
+ this.checkAuth();
|
|
|
this.$u.api.addCart({goodsId:id}).then(res=>{
|
|
|
this.$refs.uToast.show({
|
|
|
type:"success",
|
|
@@ -201,7 +213,18 @@
|
|
|
console.log('addCart',err);
|
|
|
})
|
|
|
},
|
|
|
- buyNow(id){
|
|
|
+ async buyNow(id){
|
|
|
+ try {
|
|
|
+ let authResult = await this.checkAuth();
|
|
|
+ console.log('实名认证结果:', authResult);
|
|
|
+ // 在此处可以继续执行需要进行实名认证的业务逻辑
|
|
|
+ // 例如下单购买商品等操作
|
|
|
+ } catch (err) {
|
|
|
+ console.log('实名认证未通过:', err);
|
|
|
+ return
|
|
|
+ // 在此处可以处理用户未通过实名认证的情况
|
|
|
+ // 例如返回上一页或者跳转到实名认证页等操作
|
|
|
+ }
|
|
|
// this.addCart(id,'buyNow')//跳购物车
|
|
|
let that = this;
|
|
|
if(!this.hasAddr){
|
|
@@ -223,7 +246,18 @@
|
|
|
this.$u.vuex('buyNowGoods',[{goodsId:this.id,quantity:1}]);
|
|
|
uni.$u.route('/shopping/submitorder', {fromPage: 'productdetails'});
|
|
|
},
|
|
|
- addCreditOrder(id){
|
|
|
+ async addCreditOrder(id){
|
|
|
+ try {
|
|
|
+ let authResult = await this.checkAuth();
|
|
|
+ console.log('实名认证结果:', authResult);
|
|
|
+ // 在此处可以继续执行需要进行实名认证的业务逻辑
|
|
|
+ // 例如下单购买商品等操作
|
|
|
+ } catch (err) {
|
|
|
+ console.log('实名认证未通过:', err);
|
|
|
+ return
|
|
|
+ // 在此处可以处理用户未通过实名认证的情况
|
|
|
+ // 例如返回上一页或者跳转到实名认证页等操作
|
|
|
+ }
|
|
|
let that = this;
|
|
|
let creditGoods = [];
|
|
|
creditGoods.push({id:that.details.id,quantity:1})
|
|
@@ -279,6 +313,31 @@
|
|
|
console.log('getAddrList',err.data);
|
|
|
})
|
|
|
},
|
|
|
+ checkAuth() {
|
|
|
+ // console.log('details-----',this.details);
|
|
|
+ let that = this;
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ console.log('vuex_member_info', this.vuex_member_info.isAuth);
|
|
|
+ if (that.details.isBuy!=1) {
|
|
|
+ uni.showModal({
|
|
|
+ title: '温馨提示',
|
|
|
+ content: '购买该商品需要实名认证,请先实名认证!',
|
|
|
+ success: res => {
|
|
|
+ if (res.confirm) {
|
|
|
+ let url = encodeURIComponent(`/shopping/productdetails?id=${that.id}`);
|
|
|
+ uni.$u.route('/center/factorauth', {
|
|
|
+ from: 'productdetails',
|
|
|
+ backUrl: url
|
|
|
+ });
|
|
|
+ reject('needAuth'); // 实名认证未通过,使用 reject 方法返回结果
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ resolve('noNeedAuth'); // 实名认证已通过,使用 resolve 方法返回结果
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
</script>
|