|
|
@@ -30,7 +30,6 @@
|
|
|
this.$store.commit('option/SET_BALLSLIST_SUCCESS', el)
|
|
|
},
|
|
|
buyNow: function (isBuy, event) {
|
|
|
- this.drop(event.target)
|
|
|
// let $el = this.$refs.ballCard
|
|
|
// let transform = whichTransitionEvent()
|
|
|
// let _shopCar = document.getElementById('shopCar')
|
|
|
@@ -43,87 +42,86 @@
|
|
|
// let _shopCarLeft = _shopCar.getBoundingClientRect().left
|
|
|
// $el.style[transform] = `translate3d(${_shopCarLeft}px,${_shopCarTop}px,0)`
|
|
|
event.stopPropagation()
|
|
|
- return
|
|
|
- // if (!this.$store.state.option.user.logged) {
|
|
|
- // this.$http.get('/login/page', {params: {returnUrl: window.location.href}}).then(response => {
|
|
|
- // if (response.data) {
|
|
|
- // window.location.href = response.data.content + '&baseUrl=' + encodeURIComponent(window.location.protocol + '//' + window.location.host + response.data.baseUrl)
|
|
|
- // }
|
|
|
- // })
|
|
|
- // } else {
|
|
|
- // if (this.item && !this.disabledFlag) {
|
|
|
- // if (isBuy) {
|
|
|
- // this.$http.post('/trade/order/buyNow', [{
|
|
|
- // uuid: this.item.uuid,
|
|
|
- // batchCode: this.item.batchCode,
|
|
|
- // number: this.item.minBuyQty,
|
|
|
- // storeid: this.item.storeid ? this.item.storeid : this.item.storeId,
|
|
|
- // storeUuid: this.item.storeid ? this.item.storeid : this.item.storeId,
|
|
|
- // currencyName: this.item.currencyName,
|
|
|
- // minPackQty: this.item.minPackQty
|
|
|
- // }])
|
|
|
- // .then(response => {
|
|
|
- // if (response.data.success) {
|
|
|
- // if (response.data.message) {
|
|
|
- // this.$message({
|
|
|
- // message: response.data.message,
|
|
|
- // type: 'success'
|
|
|
- // })
|
|
|
- // window.setTimeout(function () {
|
|
|
- // window.location.href = '/user#/order/pay/' + this.baseUtils.enidfilter(response.data.data.orderid)
|
|
|
- // }, 1000)
|
|
|
- // } else {
|
|
|
- // window.location.href = '/user#/order/pay/' + this.baseUtils.enidfilter(response.data.data.orderid)
|
|
|
- // }
|
|
|
- // } else {
|
|
|
- // if (response.data.data && response.data.data.unvailable === 1) {
|
|
|
- // this.$message.error('产品信息已失效,请刷新页面')
|
|
|
- // } else {
|
|
|
- // this.$message.error(response.data.message)
|
|
|
- // }
|
|
|
- // }
|
|
|
- // }, err => {
|
|
|
- // console.log(err)
|
|
|
- // if (this.item.minBuyQty > this.item.reserve) {
|
|
|
- // this.$message.error('商品' + this.item.code + '的库存已经不满足最小起订量')
|
|
|
- // }
|
|
|
- // })
|
|
|
- // } else {
|
|
|
- // this.$http.post('/trade/cart/add', {
|
|
|
- // uuid: this.item.uuid,
|
|
|
- // batchCode: this.item.batchCode,
|
|
|
- // number: this.item.minBuyQty,
|
|
|
- // storeid: this.item.storeid ? this.item.storeid : this.item.storeId,
|
|
|
- // storeUuid: this.item.storeid ? this.item.storeid : this.item.storeId,
|
|
|
- // currencyName: this.item.currencyName,
|
|
|
- // minPackQty: this.item.minPackQty
|
|
|
- // })
|
|
|
- // .then(response => {
|
|
|
- // if (response.data.success) {
|
|
|
- // if (response.data.message) {
|
|
|
- // this.$message({
|
|
|
- // message: '添加购物车成功,但商品信息有更新',
|
|
|
- // type: 'success'
|
|
|
- // })
|
|
|
- // } else {
|
|
|
- // this.$message({
|
|
|
- // message: '添加购物车成功',
|
|
|
- // type: 'success'
|
|
|
- // })
|
|
|
- // }
|
|
|
- // } else {
|
|
|
- // if (response.data.code === 2) {
|
|
|
- // this.$message.error('库存已不满足最小起订量')
|
|
|
- // } else if (response.data.message === '该产品已失效') {
|
|
|
- // this.$message.error(response.data.message + ',请刷新页面')
|
|
|
- // } else {
|
|
|
- // this.$message.error(response.data.message)
|
|
|
- // }
|
|
|
- // }
|
|
|
- // })
|
|
|
- // }
|
|
|
- // }
|
|
|
- // }
|
|
|
+ if (!this.$store.state.option.user.logged) {
|
|
|
+ this.$http.get('/login/page', {params: {returnUrl: window.location.href}}).then(response => {
|
|
|
+ if (response.data) {
|
|
|
+ window.location.href = response.data.content + '&baseUrl=' + encodeURIComponent(window.location.protocol + '//' + window.location.host + response.data.baseUrl)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ if (this.item && !this.disabledFlag) {
|
|
|
+ if (isBuy) {
|
|
|
+ this.$http.post('/trade/order/buyNow', [{
|
|
|
+ uuid: this.item.uuid,
|
|
|
+ batchCode: this.item.batchCode,
|
|
|
+ number: this.item.minBuyQty,
|
|
|
+ storeid: this.item.storeid ? this.item.storeid : this.item.storeId,
|
|
|
+ storeUuid: this.item.storeid ? this.item.storeid : this.item.storeId,
|
|
|
+ currencyName: this.item.currencyName,
|
|
|
+ minPackQty: this.item.minPackQty
|
|
|
+ }])
|
|
|
+ .then(response => {
|
|
|
+ if (response.data.success) {
|
|
|
+ if (response.data.message) {
|
|
|
+ this.$message({
|
|
|
+ message: response.data.message,
|
|
|
+ type: 'success'
|
|
|
+ })
|
|
|
+ window.setTimeout(function () {
|
|
|
+ window.location.href = '/user#/order/pay/' + this.baseUtils.enidfilter(response.data.data.orderid)
|
|
|
+ }, 1000)
|
|
|
+ } else {
|
|
|
+ window.location.href = '/user#/order/pay/' + this.baseUtils.enidfilter(response.data.data.orderid)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (response.data.data && response.data.data.unvailable === 1) {
|
|
|
+ this.$message.error('产品信息已失效,请刷新页面')
|
|
|
+ } else {
|
|
|
+ this.$message.error(response.data.message)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }, err => {
|
|
|
+ console.log(err)
|
|
|
+ if (this.item.minBuyQty > this.item.reserve) {
|
|
|
+ this.$message.error('商品' + this.item.code + '的库存已经不满足最小起订量')
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.$http.post('/trade/cart/add', {
|
|
|
+ uuid: this.item.uuid,
|
|
|
+ batchCode: this.item.batchCode,
|
|
|
+ number: this.item.minBuyQty,
|
|
|
+ storeid: this.item.storeid ? this.item.storeid : this.item.storeId,
|
|
|
+ storeUuid: this.item.storeid ? this.item.storeid : this.item.storeId,
|
|
|
+ currencyName: this.item.currencyName,
|
|
|
+ minPackQty: this.item.minPackQty
|
|
|
+ })
|
|
|
+ .then(response => {
|
|
|
+ if (response.data.success) {
|
|
|
+ if (response.data.message) {
|
|
|
+ this.$message({
|
|
|
+ message: '添加购物车成功,但商品信息有更新',
|
|
|
+ type: 'success'
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ message: '添加购物车成功',
|
|
|
+ type: 'success'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (response.data.code === 2) {
|
|
|
+ this.$message.error('库存已不满足最小起订量')
|
|
|
+ } else if (response.data.message === '该产品已失效') {
|
|
|
+ this.$message.error(response.data.message + ',请刷新页面')
|
|
|
+ } else {
|
|
|
+ this.$message.error(response.data.message)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
},
|
|
|
setHoverStyle: function (isShow) {
|
|
|
if (this.btnColor) {
|