|
@@ -98,7 +98,7 @@
|
|
|
<view class="details-tool-wrap">
|
|
|
<view class="details-tool u-flex u-row-between">
|
|
|
<view class="left u-flex">
|
|
|
- <view class="icon-wrap" @click="shareShow=true">
|
|
|
+ <view class="icon-wrap" @click="openShare">
|
|
|
<u-icon name="share" color="#676767" size="30"></u-icon>
|
|
|
分享
|
|
|
<!-- <button class="share-btn" data-name="shareBtn" open-type="share">
|
|
@@ -195,9 +195,11 @@
|
|
|
this.getDetails(this.id);
|
|
|
},
|
|
|
onShow(){
|
|
|
- this.getCartList();
|
|
|
- this.getAddrList();
|
|
|
- this.goodsAddView(this.id)
|
|
|
+ if(this.vuex_member_info.name){
|
|
|
+ this.getCartList();
|
|
|
+ this.getAddrList();
|
|
|
+ this.goodsAddView(this.id)
|
|
|
+ }
|
|
|
},
|
|
|
methods: {
|
|
|
leftClick(e){
|
|
@@ -246,6 +248,10 @@
|
|
|
})
|
|
|
},
|
|
|
async addCart(id,buyNow){
|
|
|
+ // 检测是否登录
|
|
|
+ if (!this.checkLogin()) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
try {
|
|
|
let authResult = await this.checkAuth();
|
|
|
console.log('实名认证结果:', authResult);
|
|
@@ -275,7 +281,41 @@
|
|
|
console.log('addCart',err);
|
|
|
})
|
|
|
},
|
|
|
+ checkLogin() {
|
|
|
+ if (!this.vuex_member_info.name) {
|
|
|
+ let that = this;
|
|
|
+ let pageUrl = encodeURIComponent(`shopping/productdetails?id=${that.id}`);
|
|
|
+ uni.showModal({
|
|
|
+ title: '提示',
|
|
|
+ content: '你需要登录后,才可使用此功能!',
|
|
|
+ success: res => {
|
|
|
+ if (res.confirm) {
|
|
|
+ uni.setStorage({
|
|
|
+ key: 'backUrl',
|
|
|
+ data: pageUrl,
|
|
|
+ success: function () {
|
|
|
+ uni.$u.route('/pages/login/login')
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ },
|
|
|
+ openShare(){
|
|
|
+ // 检测是否登录
|
|
|
+ // if (!this.checkLogin()) {
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
+ this.shareShow = true;
|
|
|
+ },
|
|
|
async buyNow(id){
|
|
|
+ // 检测是否登录
|
|
|
+ if (!this.checkLogin()) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
try {
|
|
|
let authResult = await this.checkAuth();
|
|
|
console.log('实名认证结果:', authResult);
|
|
@@ -288,7 +328,6 @@
|
|
|
// 例如返回上一页或者跳转到实名认证页等操作
|
|
|
}
|
|
|
// this.addCart(id,'buyNow')//跳购物车
|
|
|
- let that = this;
|
|
|
if(!this.hasAddr){
|
|
|
uni.showModal({
|
|
|
title: '温馨提示',
|
|
@@ -309,6 +348,10 @@
|
|
|
uni.$u.route('/shopping/submitorder', {fromPage: 'productdetails'});
|
|
|
},
|
|
|
async addCreditOrder(id){
|
|
|
+ // 检测是否登录
|
|
|
+ if (!this.checkLogin()) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
try {
|
|
|
let authResult = await this.checkAuth();
|
|
|
console.log('实名认证结果:', authResult);
|
|
@@ -380,7 +423,7 @@
|
|
|
let that = this;
|
|
|
return new Promise((resolve, reject) => {
|
|
|
console.log('vuex_member_info', this.vuex_member_info.isAuth);
|
|
|
- if (that.details.isBuy&&that.details.isBuy!=1) {
|
|
|
+ if (that.details.isBuy!=1&&that.details.isAuth==1) {
|
|
|
uni.showModal({
|
|
|
title: '温馨提示',
|
|
|
content: '购买该商品需要实名认证,请先实名认证!',
|