vip换购列表更改及部分拼团功能融合
This commit is contained in:
@@ -34,7 +34,7 @@
|
||||
<view class="block info-box">
|
||||
<view class="info-item">
|
||||
<view class="label">购买数量</view>
|
||||
<uni-number-box class="info-number" :value="qty" :min="1" :max="999" @change="numberChange" />
|
||||
<uni-number-box class="info-number" :value="qty" :min="1" :max="limit" @change="numberChange" />
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<view class="label">配送方式</view>
|
||||
@@ -61,8 +61,10 @@
|
||||
|
||||
<script>
|
||||
import {
|
||||
buy,
|
||||
verify
|
||||
buy,
|
||||
buyPin,
|
||||
verify,
|
||||
collages,
|
||||
} from '@/apis/interfaces/store'
|
||||
export default {
|
||||
data() {
|
||||
@@ -73,38 +75,71 @@
|
||||
freight: 0,
|
||||
address: "",
|
||||
remark: "",
|
||||
canApply: true
|
||||
canApply: true,
|
||||
limit:0,
|
||||
type: '', // 是否为空
|
||||
};
|
||||
},
|
||||
onShow() {
|
||||
if (JSON.stringify(this.$store.getters.getAddress) !== '{}') this.address = this.$store.getters.getAddress
|
||||
this.qty = this.$Route.query.qty;
|
||||
},
|
||||
mounted() {
|
||||
onLoad() {
|
||||
if (this.$Route.query.type === 'pin') {
|
||||
this.type = 'pin'
|
||||
}
|
||||
this.getBuy()
|
||||
},
|
||||
methods: {
|
||||
getBuy() {
|
||||
buy({
|
||||
goods_sku_id: this.$Route.query.skuId,
|
||||
qty: this.qty
|
||||
}).then(res => {
|
||||
this.address = res.address
|
||||
this.freight = res.freight
|
||||
this.total = res.total
|
||||
this.goodsInfo = res.detail
|
||||
}).catch(err => {
|
||||
uni.showModal({
|
||||
title: '温馨提示',
|
||||
content: err.message,
|
||||
showCancel: false,
|
||||
confirmColor: '#34CE98',
|
||||
cancelText: '知道了',
|
||||
success: (res) => {
|
||||
uni.navigateBack({ })
|
||||
}
|
||||
getBuy() {
|
||||
console.log(this.type === 'pin')
|
||||
if (this.type == 'pin') {
|
||||
let data = {
|
||||
goods_sku_id: this.$Route.query.skuId,
|
||||
collage_id:this.$Route.query.collageid || '',
|
||||
}
|
||||
console.log(data);
|
||||
buyPin(data).then(res => {
|
||||
this.address = res.address
|
||||
this.freight = res.freight
|
||||
this.total = res.total
|
||||
this.goodsInfo = res.detail
|
||||
this.limit = res.limit
|
||||
}).catch(err => {
|
||||
uni.showModal({
|
||||
title: '温馨提示',
|
||||
content: err.message,
|
||||
showCancel: false,
|
||||
confirmColor: '#34CE98',
|
||||
cancelText: '知道了',
|
||||
success: (res) => {
|
||||
uni.navigateBack({})
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
} else {
|
||||
buy({
|
||||
goods_sku_id: this.$Route.query.skuId,
|
||||
qty: this.qty
|
||||
}).then(res => {
|
||||
this.address = res.address
|
||||
this.freight = res.freight
|
||||
this.total = res.total
|
||||
this.goodsInfo = res.detail
|
||||
this.limit = res.limit
|
||||
}).catch(err => {
|
||||
uni.showModal({
|
||||
title: '温馨提示',
|
||||
content: err.message,
|
||||
showCancel: false,
|
||||
confirmColor: '#34CE98',
|
||||
cancelText: '知道了',
|
||||
success: (res) => {
|
||||
uni.navigateBack({})
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
},
|
||||
numberChange(e) {
|
||||
this.qty = e
|
||||
@@ -129,56 +164,87 @@
|
||||
return
|
||||
}
|
||||
if (this.canApply) {
|
||||
this.canApply = false;
|
||||
verify({
|
||||
goods_sku_id: this.$Route.query.skuId,
|
||||
qty: this.qty,
|
||||
address_id: this.address.address_id,
|
||||
remark: this.remark || ''
|
||||
}).then(res => {
|
||||
console.log(res)
|
||||
if (res.order_no === '') {
|
||||
uni.showModal({
|
||||
title: ' 温馨提示',
|
||||
content: '领取商品成功',
|
||||
confirmColor: '#34CE98',
|
||||
confirmText: ' 查看订单',
|
||||
cancelColor: '#999',
|
||||
cancelText: '返回首页',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/order/index?index=0'
|
||||
})
|
||||
}
|
||||
if (res.cancel) {
|
||||
uni.reLaunch({
|
||||
url: '/pages/store/index'
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.$store.commit('setAddress', {})
|
||||
this.$Router.replace({
|
||||
name: 'Pay',
|
||||
params: {
|
||||
orderNo: res.order_no,
|
||||
price: res.total,
|
||||
coins: res.coins,
|
||||
}
|
||||
})
|
||||
}
|
||||
this.canApply = true
|
||||
}).catch(err => {
|
||||
this.canApply = true
|
||||
uni.showToast({
|
||||
title: err.message,
|
||||
icon: "none",
|
||||
mask: true,
|
||||
duration: 2000
|
||||
})
|
||||
})
|
||||
this.canApply = false;
|
||||
if (this.type == 'pin'){
|
||||
collages({
|
||||
goods_sku_id: this.$Route.query.skuId,
|
||||
collage_id:this.$Route.query.collageid || '',
|
||||
address_id: this.address.address_id,
|
||||
remark: this.remark || ''
|
||||
}).then(res => {
|
||||
console.log(res)
|
||||
this.$store.commit('setAddress', {})
|
||||
this.$Router.replace({
|
||||
name: 'Pay',
|
||||
params: {
|
||||
orderNo: res.order_no,
|
||||
price: res.total,
|
||||
coins: res.coins,
|
||||
type:'pin'
|
||||
}
|
||||
})
|
||||
this.canApply = true
|
||||
}).catch(err => {
|
||||
this.canApply = true
|
||||
uni.showToast({
|
||||
title: err.message,
|
||||
icon: "none",
|
||||
mask: true,
|
||||
duration: 2000
|
||||
})
|
||||
})
|
||||
}else{
|
||||
verify({
|
||||
goods_sku_id: this.$Route.query.skuId,
|
||||
qty: this.qty,
|
||||
address_id: this.address.address_id,
|
||||
remark: this.remark || ''
|
||||
}).then(res => {
|
||||
console.log(res)
|
||||
if (res.order_no === '') {
|
||||
uni.showModal({
|
||||
title: ' 温馨提示',
|
||||
content: '领取商品成功',
|
||||
confirmColor: '#34CE98',
|
||||
confirmText: ' 查看订单',
|
||||
cancelColor: '#999',
|
||||
cancelText: '返回首页',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/order/index?index=0'
|
||||
})
|
||||
}
|
||||
if (res.cancel) {
|
||||
uni.reLaunch({
|
||||
url: '/pages/store/index'
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.$store.commit('setAddress', {})
|
||||
this.$Router.replace({
|
||||
name: 'Pay',
|
||||
params: {
|
||||
orderNo: res.order_no,
|
||||
price: res.total,
|
||||
coins: res.coins,
|
||||
}
|
||||
})
|
||||
}
|
||||
this.canApply = true
|
||||
}).catch(err => {
|
||||
this.canApply = true
|
||||
uni.showToast({
|
||||
title: err.message,
|
||||
icon: "none",
|
||||
mask: true,
|
||||
duration: 2000
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
} else {
|
||||
this.canApply = true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user