Browse Source

未登录用户允许访问商品详情页面

zyh
Gao xiaosong 4 years ago
parent
commit
8aa46ec1d4
  1. 2
      config/index.js
  2. 71
      pages/shop/GoodsCon/index.vue

2
config/index.js

@ -3,7 +3,7 @@ export const VUE_APP_API_URL = 'https://wxapi.yixiang.co/api'
// export const VUE_APP_API_URL = 'http://139.186.134.205:9006/api' // export const VUE_APP_API_URL = 'http://139.186.134.205:9006/api'
// export const VUE_APP_API_URL = 'http://192.168.31.223:8008/api' // export const VUE_APP_API_URL = 'http://192.168.31.223:8008/api'
// export const VUE_APP_API_URL = 'http://natapp.xinxintuan.co/api'; // export const VUE_APP_API_URL = 'http://natapp.xinxintuan.co/api';
// export const VUE_APP_API_URL = 'https://tapi.xinxintuan.co/api' // export const VUE_APP_API_URL = 'https://thapi.xinxintuan.co/api'
// export const VUE_APP_API_URL = 'https://h5api.xinxintuan.co/api'; // export const VUE_APP_API_URL = 'https://h5api.xinxintuan.co/api';
// export const VUE_APP_API_URL = 'https://h5api.xinxintuan.co/api'; // export const VUE_APP_API_URL = 'https://h5api.xinxintuan.co/api';
export const VUE_APP_RESOURCES_URL = 'https://wx.yixiang.co/static' export const VUE_APP_RESOURCES_URL = 'https://wx.yixiang.co/static'

71
pages/shop/GoodsCon/index.vue

@ -229,7 +229,7 @@ export default {
StorePoster, StorePoster,
ShareInfo, ShareInfo,
}, },
data: function () { data: function() {
return { return {
shareInfoStatus: false, shareInfoStatus: false,
weixinStatus: false, weixinStatus: false,
@ -287,13 +287,14 @@ export default {
} }
}, },
computed: mapGetters(['isLogin', 'location']), computed: mapGetters(['isLogin', 'location']),
mounted: function () { mounted: function() {
this.$store.commit('get_to', 'goodcon') this.$store.commit('get_to', 'goodcon')
let url = handleQrCode() let url = handleQrCode()
if (!url) { if (!url) {
url = handleUrlParam(getCurrentPageUrlWithArgs()) url = handleUrlParam(getCurrentPageUrlWithArgs())
} }
this.coupons()
const token = cookie.get('login_status')
if (url && url.id) { if (url && url.id) {
this.id = url.id this.id = url.id
let urlSpread = parseInt(url.spread) let urlSpread = parseInt(url.spread)
@ -303,7 +304,15 @@ export default {
} else { } else {
this.id = this._route.query.id this.id = this._route.query.id
} }
this.isIntegral = url.isIntegral == 'true' this.isIntegral = url.isIntegral == 'true'
if (!token) {
this.productCon()
return
}
this.coupons()
this.productCon() this.productCon()
this.setOpenShare() this.setOpenShare()
}, },
@ -318,7 +327,7 @@ export default {
}, },
}, },
methods: { methods: {
onShareAppMessage: function () { onShareAppMessage: function() {
return { return {
title: this.storeInfo.storeName, title: this.storeInfo.storeName,
imageUrl: this.storeInfo.image, imageUrl: this.storeInfo.image,
@ -368,7 +377,7 @@ export default {
}, },
}) })
}, },
showChang: function (data) { showChang: function(data) {
this.$yrouter.push({ this.$yrouter.push({
path: '/pages/map/index', path: '/pages/map/index',
query: data, query: data,
@ -377,23 +386,23 @@ export default {
updateTitle() { updateTitle() {
// document.title = this.storeInfo.storeName || this.$yroute.meta.title; // document.title = this.storeInfo.storeName || this.$yroute.meta.title;
}, },
setShareInfoStatus: function () { setShareInfoStatus: function() {
this.shareInfoStatus = !this.shareInfoStatus this.shareInfoStatus = !this.shareInfoStatus
this.posters = false this.posters = false
}, },
shareCode: function () { shareCode: function() {
var that = this var that = this
getProductCode(that.id).then(res => { getProductCode(that.id).then(res => {
that.posterData.code = res.data.code that.posterData.code = res.data.code
that.listenerActionSheet() that.listenerActionSheet()
}) })
}, },
setPosterImageStatus: function () { setPosterImageStatus: function() {
this.posterImageStatus = !this.posterImageStatus this.posterImageStatus = !this.posterImageStatus
this.posters = false this.posters = false
}, },
// //
productCon: function () { productCon: function() {
let that = this let that = this
let from = this.location let from = this.location
if (this.$deviceType == 'app') { if (this.$deviceType == 'app') {
@ -453,7 +462,7 @@ export default {
}) })
}, },
// //
DefaultSelect: function () { DefaultSelect: function() {
let productAttr = this.attr.productAttr let productAttr = this.attr.productAttr
let value = [] let value = []
for (let i = 0; i < productAttr.length; i++) { for (let i = 0; i < productAttr.length; i++) {
@ -495,7 +504,7 @@ export default {
} }
}, },
// //
ChangeCartNum: function (changeValue) { ChangeCartNum: function(changeValue) {
//changeValue: | //changeValue: |
// //
let productSelect = this.productValue[this.attrValue] let productSelect = this.productValue[this.attrValue]
@ -528,29 +537,29 @@ export default {
} }
}, },
// //
changeFun: function (opt) { changeFun: function(opt) {
if (typeof opt !== 'object') opt = {} if (typeof opt !== 'object') opt = {}
let action = opt.action || '' let action = opt.action || ''
let value = opt.value === undefined ? '' : opt.value let value = opt.value === undefined ? '' : opt.value
this[action] && this[action](value) this[action] && this[action](value)
}, },
// //
couponTap: function () { couponTap: function() {
let that = this let that = this
that.coupons() that.coupons()
that.coupon.coupon = true that.coupon.coupon = true
}, },
changecoupon: function (msg) { changecoupon: function(msg) {
this.coupon.coupon = msg this.coupon.coupon = msg
this.coupons() this.coupons()
}, },
currentcoupon: function (res) { currentcoupon: function(res) {
let that = this let that = this
that.coupon.coupon = false that.coupon.coupon = false
that.$set(that.coupon.list[res], 'is_use', true) that.$set(that.coupon.list[res], 'is_use', true)
}, },
// //
coupons: function () { coupons: function() {
let that = this, let that = this,
q = { q = {
page: 1, page: 1,
@ -562,18 +571,18 @@ export default {
}) })
}, },
// //
selecAttrTap: function () { selecAttrTap: function() {
this.attr.cartAttr = true this.attr.cartAttr = true
this.isOpen = true this.isOpen = true
}, },
changeattr: function (msg) { changeattr: function(msg) {
// //
console.log(msg) console.log(msg)
this.attr.cartAttr = msg this.attr.cartAttr = msg
this.isOpen = false this.isOpen = false
}, },
// //
ChangeAttr: function (res) { ChangeAttr: function(res) {
// //
let productSelect = this.productValue[res.value] let productSelect = this.productValue[res.value]
@ -600,27 +609,27 @@ export default {
} }
}, },
// //
setCollect: function () { setCollect: function() {
let that = this, let that = this,
id = that.storeInfo.id, id = that.storeInfo.id,
category = 'collect' category = 'collect'
if (that.storeInfo.userCollect) { if (that.storeInfo.userCollect) {
getCollectDel(id, category).then(function () { getCollectDel(id, category).then(function() {
that.storeInfo.userCollect = !that.storeInfo.userCollect that.storeInfo.userCollect = !that.storeInfo.userCollect
}) })
} else { } else {
getCollectAdd(id, category).then(function () { getCollectAdd(id, category).then(function() {
that.storeInfo.userCollect = !that.storeInfo.userCollect that.storeInfo.userCollect = !that.storeInfo.userCollect
}) })
} }
}, },
// //
joinCart: function () { joinCart: function() {
//0= //0=
this.goCat(0) this.goCat(0)
}, },
// //
goCat: function (news) { goCat: function(news) {
let that = this, let that = this,
productSelect = that.productValue[this.attrValue] productSelect = that.productValue[this.attrValue]
// //
@ -649,7 +658,7 @@ export default {
uniqueId: that.attr.productSelect !== undefined ? that.attr.productSelect.unique : '', uniqueId: that.attr.productSelect !== undefined ? that.attr.productSelect.unique : '',
} }
postCartAdd(q) postCartAdd(q)
.then(function (res) { .then(function(res) {
console.log(res) console.log(res)
that.isOpen = false that.isOpen = false
that.attr.cartAttr = false that.attr.cartAttr = false
@ -691,7 +700,7 @@ export default {
}) })
}, },
// //
getCartCount: function (isAnima) { getCartCount: function(isAnima) {
let that = this let that = this
const isLogin = that.isLogin const isLogin = that.isLogin
if (isLogin) { if (isLogin) {
@ -702,7 +711,7 @@ export default {
// //
if (isAnima) { if (isAnima) {
that.animated = true that.animated = true
setTimeout(function () { setTimeout(function() {
that.animated = false that.animated = false
}, 500) }, 500)
} }
@ -710,20 +719,20 @@ export default {
} }
}, },
// //
tapBuy: function () { tapBuy: function() {
// 1= // 1=
this.goCat(1) this.goCat(1)
}, },
listenerActionSheet: function () { listenerActionSheet: function() {
if (isWeixin() === true) { if (isWeixin() === true) {
this.weixinStatus = true this.weixinStatus = true
} }
this.posters = true this.posters = true
}, },
listenerActionClose: function () { listenerActionClose: function() {
this.posters = false this.posters = false
}, },
setOpenShare: function () { setOpenShare: function() {
var data = this.storeInfo var data = this.storeInfo
var href = this.location.href var href = this.location.href
if (this.$deviceType == 'weixin') { if (this.$deviceType == 'weixin') {

Loading…
Cancel
Save