|
|
@@ -28,7 +28,6 @@
|
|
|
</template>
|
|
|
<script>
|
|
|
import Buy from '~components/common/buyOrCar/buyComponent.vue'
|
|
|
- import axios from '~/plugins/axios'
|
|
|
export default {
|
|
|
name: 'recommend-product',
|
|
|
components: {
|
|
|
@@ -52,29 +51,67 @@
|
|
|
})
|
|
|
} else {
|
|
|
if (item) {
|
|
|
- // this.$emit('buyAction', [{uuid: item.uuid, batchCode: item.batchCode, number: item.minBuyQty}])
|
|
|
if (isBuy) {
|
|
|
- // this.$store.dispatch('user/getBuyInfo', [{uuid: item.uuid, batchCode: item.batchCode, number: item.minBuyQty}])
|
|
|
- axios.post('trade/order/buyNow', [{uuid: item.uuid, batchCode: item.batchCode, number: item.minBuyQty}])
|
|
|
+ this.$http.post('trade/order/buyNow', [{
|
|
|
+ uuid: item.comUuid,
|
|
|
+ batchCode: item.batchCode,
|
|
|
+ number: item.minBuyQty,
|
|
|
+ storeid: item.storeId,
|
|
|
+ storeUuid: item.storeUuid,
|
|
|
+ currencyName: item.currency,
|
|
|
+ minPackQty: item.minPackQty
|
|
|
+ }])
|
|
|
.then(response => {
|
|
|
- window.location.href = '/user#/order/pay/' + this.enidfilter(response.data.orderid)
|
|
|
+ // window.location.href = '/user#/order/pay/' + this.enidfilter(response.data.orderid)
|
|
|
+ if (response.data.success) {
|
|
|
+ if (response.data.message) {
|
|
|
+ this.$message({
|
|
|
+ message: response.data.message,
|
|
|
+ type: 'success'
|
|
|
+ })
|
|
|
+ let _self = this
|
|
|
+ window.setTimeout(function () {
|
|
|
+ window.location.href = '/user#/order/pay/' + _self.enidfilter(response.data.data.orderid)
|
|
|
+ }, 1000)
|
|
|
+ } else {
|
|
|
+ window.location.href = '/user#/order/pay/' + this.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 => {
|
|
|
- this.$message.error('以下器件null对应的商品不存在,请您重新选择')
|
|
|
console.log(err)
|
|
|
})
|
|
|
} else {
|
|
|
- console.log(item)
|
|
|
// this.$store.dispatch('user/addCar', {uuid: item.uuid, batchCode: item.batchCode, number: item.minBuyQty})
|
|
|
- axios.post('trade/cart/add', {uuid: item.comUuid, batchCode: item.batchCode, number: item.minBuyQty, currencyName: item.currency})
|
|
|
+ this.$http.post('trade/cart/add', {
|
|
|
+ uuid: item.comUuid,
|
|
|
+ batchCode: item.batchCode,
|
|
|
+ number: item.minBuyQty,
|
|
|
+ storeid: item.storeId,
|
|
|
+ storeUuid: item.storeUuid,
|
|
|
+ currencyName: item.currency,
|
|
|
+ minPackQty: item.minPackQty
|
|
|
+ })
|
|
|
.then(response => {
|
|
|
if (response.data.success) {
|
|
|
- this.$message({
|
|
|
- message: '添加购物车成功',
|
|
|
- type: 'success'
|
|
|
- })
|
|
|
+ if (response.data.message) {
|
|
|
+ this.$message({
|
|
|
+ message: '添加购物车成功,但商品信息有更新',
|
|
|
+ type: 'success'
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ message: '添加购物车成功',
|
|
|
+ type: 'success'
|
|
|
+ })
|
|
|
+ }
|
|
|
} else {
|
|
|
this.$message.error(response.data.message)
|
|
|
- // console.log(response.data.message)
|
|
|
}
|
|
|
})
|
|
|
}
|