feat(cart): 购物车添加加购物品校验逻辑
This commit is contained in:
parent
a35ba61785
commit
bc142f686b
|
@ -152,7 +152,7 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import * as api from '@/config/goods'
|
import * as api from '@/config/goods'
|
||||||
|
import { canOrder } from '@/config/order'
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
@ -339,10 +339,33 @@ export default {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
goBuy() {
|
canOrder(shoppingArr) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
canOrder({
|
||||||
|
shoppingIds: shoppingArr,
|
||||||
|
specialArea: this.specialArea,
|
||||||
|
}).then(res => {
|
||||||
|
if (res.code == 200 && res.data?.flag === 0) {
|
||||||
|
resolve(true)
|
||||||
|
} else {
|
||||||
|
reject(res.data?.msg)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
async goBuy() {
|
||||||
let shoppArr = this.goodsCheck[0].orderItemsParams.map(item => {
|
let shoppArr = this.goodsCheck[0].orderItemsParams.map(item => {
|
||||||
return item.shoppingId
|
return item.shoppingId
|
||||||
})
|
})
|
||||||
|
try {
|
||||||
|
await this.canOrder(shoppArr)
|
||||||
|
} catch (msg) {
|
||||||
|
uni.showToast({
|
||||||
|
title: msg,
|
||||||
|
icon: 'none',
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
uni.setStorageSync('allGoods', JSON.stringify(shoppArr))
|
uni.setStorageSync('allGoods', JSON.stringify(shoppArr))
|
||||||
if (
|
if (
|
||||||
this.goodsCheck[0].specialArea == 1 ||
|
this.goodsCheck[0].specialArea == 1 ||
|
||||||
|
|
|
@ -1,34 +1,46 @@
|
||||||
|
|
||||||
const http = uni.$u.http
|
const http = uni.$u.http
|
||||||
|
|
||||||
//支付配置
|
//支付配置
|
||||||
export const payConfig = (params) => http.get('/pay/config', { params })
|
export const payConfig = params => http.get('/pay/config', { params })
|
||||||
//查询订单明细
|
//查询订单明细
|
||||||
export const orderInfo = (params) => http.post('/sale/api/order/query-order', params)
|
export const orderInfo = params =>
|
||||||
|
http.post('/sale/api/order/query-order', params)
|
||||||
//订单状态
|
//订单状态
|
||||||
export const orderStatus = (params) => http.get('/system/pub/enums/order-status-api', { params })
|
export const orderStatus = params =>
|
||||||
|
http.get('/system/pub/enums/order-status-api', { params })
|
||||||
|
|
||||||
//计算邮费
|
//计算邮费
|
||||||
export const pickPostAge = (params) => http.get('/activity/api/pick/postage', { params })
|
export const pickPostAge = params =>
|
||||||
|
http.get('/activity/api/pick/postage', { params })
|
||||||
//订单列表
|
//订单列表
|
||||||
export const orderList = (params) => http.get('/sale/api/my-order/list', { params })
|
export const orderList = params =>
|
||||||
|
http.get('/sale/api/my-order/list', { params })
|
||||||
//订单详情
|
//订单详情
|
||||||
export const orderDetails = (orderCode) => http.get('/sale/api/my-order/detail/' + orderCode)
|
export const orderDetails = orderCode =>
|
||||||
|
http.get('/sale/api/my-order/detail/' + orderCode)
|
||||||
//订单取消
|
//订单取消
|
||||||
export const cancelOrder = (orderCode) => http.delete('/sale/api/my-order/cancel/' + orderCode)
|
export const cancelOrder = orderCode =>
|
||||||
|
http.delete('/sale/api/my-order/cancel/' + orderCode)
|
||||||
//物流状态
|
//物流状态
|
||||||
export const expressList = (id) => http.get('/sale/api/my-order/express/' + id,)
|
export const expressList = id => http.get('/sale/api/my-order/express/' + id)
|
||||||
//校验订单状态
|
//校验订单状态
|
||||||
export const payCheck = (id) => http.get('/sale/api/my-order/pay-check/' + id,)
|
export const payCheck = id => http.get('/sale/api/my-order/pay-check/' + id)
|
||||||
//订单类型
|
//订单类型
|
||||||
export const orderType = (params) => http.get('/sale/api/my-order/order-type', { params })
|
export const orderType = params =>
|
||||||
|
http.get('/sale/api/my-order/order-type', { params })
|
||||||
//提货卡详情
|
//提货卡详情
|
||||||
export const pickDetails = (params) => http.get('/activity/api/pick/detail', { params })
|
export const pickDetails = params =>
|
||||||
|
http.get('/activity/api/pick/detail', { params })
|
||||||
|
|
||||||
//自助撤单列表
|
//自助撤单列表
|
||||||
export const selfRevokeList = (params) => http.get('/sale/api/my-order/selfRevokeList', { params })
|
export const selfRevokeList = params =>
|
||||||
|
http.get('/sale/api/my-order/selfRevokeList', { params })
|
||||||
//自助撤单参数校验
|
//自助撤单参数校验
|
||||||
export const selfRevokeListCheck = (params) => http.post('/sale/api/my-order/check-self-revoke-order', params)
|
export const selfRevokeListCheck = params =>
|
||||||
|
http.post('/sale/api/my-order/check-self-revoke-order', params)
|
||||||
//自助撤单
|
//自助撤单
|
||||||
export const selfRevokeOrder = (params) => http.post('/sale/api/my-order/self-revoke-order', params)
|
export const selfRevokeOrder = params =>
|
||||||
|
http.post('/sale/api/my-order/self-revoke-order', params)
|
||||||
|
|
||||||
|
export const canOrder = data =>
|
||||||
|
http.post('/sale/api/order/check-before-confirm', data)
|
||||||
|
|
|
@ -99,6 +99,5 @@ export const specialExport = params =>
|
||||||
export const specialList = params =>
|
export const specialList = params =>
|
||||||
http.get('/member/api/member-special/special-list', { params })
|
http.get('/member/api/member-special/special-list', { params })
|
||||||
|
|
||||||
// 创客空间接口
|
// 判断选中商品是否可以下单
|
||||||
export const queryCard = params =>
|
export const canOrder = data => http.post('/sale/api/order/can-order', data)
|
||||||
http.post('/sale/api/wares/query-cabin-card', params)
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ module.exports = vm => {
|
||||||
|
|
||||||
//#ifdef DEV_SERVER
|
//#ifdef DEV_SERVER
|
||||||
console.log('DEV_SERVER')
|
console.log('DEV_SERVER')
|
||||||
config.baseURL = 'https://t-app.beida666.com/prod-api'
|
config.baseURL = 'http://localhost:8080'
|
||||||
//#endif
|
//#endif
|
||||||
|
|
||||||
//#ifdef QA_SERVER
|
//#ifdef QA_SERVER
|
||||||
|
|
|
@ -415,14 +415,6 @@
|
||||||
:columns="transList"
|
:columns="transList"
|
||||||
keyName="label"
|
keyName="label"
|
||||||
></u-picker>
|
></u-picker>
|
||||||
<!-- 创客空间 -->
|
|
||||||
<u-picker
|
|
||||||
:show="ishowSure"
|
|
||||||
@cancel="ishowSure = false"
|
|
||||||
@confirm="surehowSure"
|
|
||||||
:columns="queryCardList"
|
|
||||||
keyName="label"
|
|
||||||
></u-picker>
|
|
||||||
|
|
||||||
<!-- 强制阅读协议 -->
|
<!-- 强制阅读协议 -->
|
||||||
<mustAgreeMent :waresCodeList="waresCodeList"></mustAgreeMent>
|
<mustAgreeMent :waresCodeList="waresCodeList"></mustAgreeMent>
|
||||||
|
@ -596,9 +588,6 @@ export default {
|
||||||
checkObj: {},
|
checkObj: {},
|
||||||
selTable: [],
|
selTable: [],
|
||||||
pkCountry: '',
|
pkCountry: '',
|
||||||
howSure: false,
|
|
||||||
ishowSure: false,
|
|
||||||
queryCardList: [],
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
|
@ -718,16 +707,6 @@ export default {
|
||||||
})
|
})
|
||||||
this.allGoodsData.deleteList = deleteList
|
this.allGoodsData.deleteList = deleteList
|
||||||
this.allGoodsData.upgradeMemberCode = this.form.upgradeMemberCode
|
this.allGoodsData.upgradeMemberCode = this.form.upgradeMemberCode
|
||||||
if (this.specialArea == 2) {
|
|
||||||
let howSure = this.allGoodsData.orderItemsParams.some(
|
|
||||||
item => item.isMakerGift == 4 || item.isMakerGift == 0
|
|
||||||
)
|
|
||||||
this.howSure = howSure
|
|
||||||
// 获取创客空间
|
|
||||||
if (this.howSure) {
|
|
||||||
this.getQueryCard()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
api.memLevel(this.allGoodsData).then(res => {
|
api.memLevel(this.allGoodsData).then(res => {
|
||||||
if (res.data.isEnough) {
|
if (res.data.isEnough) {
|
||||||
|
@ -1021,28 +1000,7 @@ export default {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
getQueryCard() {
|
|
||||||
api
|
|
||||||
.queryCard({
|
|
||||||
specialArea: this.specialArea,
|
|
||||||
upgradeMemberCode: this.form.upgradeMemberCode,
|
|
||||||
})
|
|
||||||
.then(res => {
|
|
||||||
let data = res.data.map(item => {
|
|
||||||
return {
|
|
||||||
id: item.pkMember,
|
|
||||||
label: item.storeName,
|
|
||||||
}
|
|
||||||
})
|
|
||||||
this.queryCardList = [data]
|
|
||||||
})
|
|
||||||
},
|
|
||||||
surehowSure(e) {
|
|
||||||
const { value } = e
|
|
||||||
this.form.makerSpaceMember = value[0].id
|
|
||||||
this.form.makerSpaceMemberLabel = value[0].label
|
|
||||||
this.ishowSure = false
|
|
||||||
},
|
|
||||||
sureTrans(e) {
|
sureTrans(e) {
|
||||||
const { value } = e
|
const { value } = e
|
||||||
this.form.transType = value[0].id
|
this.form.transType = value[0].id
|
||||||
|
|
|
@ -513,14 +513,6 @@
|
||||||
:columns="transList"
|
:columns="transList"
|
||||||
keyName="label"
|
keyName="label"
|
||||||
></u-picker>
|
></u-picker>
|
||||||
<!-- 创客空间 -->
|
|
||||||
<u-picker
|
|
||||||
:show="ishowSure"
|
|
||||||
@cancel="ishowSure = false"
|
|
||||||
@confirm="surehowSure"
|
|
||||||
:columns="queryCardList"
|
|
||||||
keyName="label"
|
|
||||||
></u-picker>
|
|
||||||
|
|
||||||
<!-- 银行名称 -->
|
<!-- 银行名称 -->
|
||||||
<u-picker
|
<u-picker
|
||||||
|
@ -838,10 +830,6 @@ export default {
|
||||||
this.allGoodsData.specialArea = this.specialArea
|
this.allGoodsData.specialArea = this.specialArea
|
||||||
this.allGoodsData.pkSettleCountry = this.pkCountry
|
this.allGoodsData.pkSettleCountry = this.pkCountry
|
||||||
|
|
||||||
let howSure = this.allGoodsData.orderItemsParams.some(
|
|
||||||
item => item.isMakerGift == 4 || item.isMakerGift == 0
|
|
||||||
)
|
|
||||||
this.howSure = howSure
|
|
||||||
this.selTable.forEach(item => {
|
this.selTable.forEach(item => {
|
||||||
this.allGoodsData.orderItemsParams.push(item)
|
this.allGoodsData.orderItemsParams.push(item)
|
||||||
})
|
})
|
||||||
|
@ -938,10 +926,7 @@ export default {
|
||||||
// 普通注册首单
|
// 普通注册首单
|
||||||
this.pt = false
|
this.pt = false
|
||||||
}
|
}
|
||||||
// 获取创客空间
|
|
||||||
if (this.howSure) {
|
|
||||||
this.getQueryCard()
|
|
||||||
}
|
|
||||||
this.$forceUpdate()
|
this.$forceUpdate()
|
||||||
} else {
|
} else {
|
||||||
console.log(122)
|
console.log(122)
|
||||||
|
@ -970,10 +955,7 @@ export default {
|
||||||
// 普通注册首单
|
// 普通注册首单
|
||||||
this.pt = false
|
this.pt = false
|
||||||
}
|
}
|
||||||
// 获取创客空间
|
|
||||||
if (this.howSure) {
|
|
||||||
this.getQueryCard()
|
|
||||||
}
|
|
||||||
this.$forceUpdate()
|
this.$forceUpdate()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -1173,19 +1155,6 @@ export default {
|
||||||
// }
|
// }
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
getQueryCard() {
|
|
||||||
api
|
|
||||||
.queryCard({ specialArea: this.specialArea, parent: this.form.parent })
|
|
||||||
.then(res => {
|
|
||||||
let data = res.data.map(item => {
|
|
||||||
return {
|
|
||||||
id: item.pkMember,
|
|
||||||
label: item.storeName,
|
|
||||||
}
|
|
||||||
})
|
|
||||||
this.queryCardList = [data]
|
|
||||||
})
|
|
||||||
},
|
|
||||||
getDeliveryList() {
|
getDeliveryList() {
|
||||||
api.deliveryList({ pkCountry: this.pkCountry }).then(res => {
|
api.deliveryList({ pkCountry: this.pkCountry }).then(res => {
|
||||||
let data = res.data.map(item => {
|
let data = res.data.map(item => {
|
||||||
|
@ -1219,12 +1188,7 @@ export default {
|
||||||
this.form.transTypeLabel = value[0].label
|
this.form.transTypeLabel = value[0].label
|
||||||
this.isTrans = false
|
this.isTrans = false
|
||||||
},
|
},
|
||||||
surehowSure(e) {
|
|
||||||
const { value } = e
|
|
||||||
this.form.makerSpaceMember = value[0].id
|
|
||||||
this.form.makerSpaceMemberLabel = value[0].label
|
|
||||||
this.ishowSure = false
|
|
||||||
},
|
|
||||||
sureCk(e) {
|
sureCk(e) {
|
||||||
const { value } = e
|
const { value } = e
|
||||||
this.form.pkStorehouse = value[0].id
|
this.form.pkStorehouse = value[0].id
|
||||||
|
|
|
@ -182,7 +182,7 @@
|
||||||
import * as api from '@/config/goods'
|
import * as api from '@/config/goods'
|
||||||
import clTabbar from '@/components/cl-tabbar.vue'
|
import clTabbar from '@/components/cl-tabbar.vue'
|
||||||
import RaisedTabbar from '@/components/raised-tabbar.vue'
|
import RaisedTabbar from '@/components/raised-tabbar.vue'
|
||||||
|
import { canOrder } from '@/config/order'
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
'cl-tabbar': RaisedTabbar,
|
'cl-tabbar': RaisedTabbar,
|
||||||
|
@ -313,11 +313,34 @@ export default {
|
||||||
this.checkArea()
|
this.checkArea()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
goBuy() {
|
canOrder(shoppingIds, specialArea) {
|
||||||
console.log(this.goodsCheck[0])
|
return new Promise((resolve, reject) => {
|
||||||
|
canOrder({
|
||||||
|
shoppingIds,
|
||||||
|
specialArea,
|
||||||
|
}).then(res => {
|
||||||
|
if (res.code == 200 && res.data?.flag === 0) {
|
||||||
|
resolve(true)
|
||||||
|
} else {
|
||||||
|
reject(res.data?.msg)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
async goBuy() {
|
||||||
let shoppArr = this.goodsCheck[0].orderItemsParams.map(item => {
|
let shoppArr = this.goodsCheck[0].orderItemsParams.map(item => {
|
||||||
return item.shoppingId
|
return item.shoppingId
|
||||||
})
|
})
|
||||||
|
try {
|
||||||
|
await this.canOrder(shoppArr, this.goodsCheck[0].specialArea)
|
||||||
|
} catch (msg) {
|
||||||
|
uni.showToast({
|
||||||
|
title: msg,
|
||||||
|
icon: 'none',
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
this.goodsCheck[0].specialArea == 1 ||
|
this.goodsCheck[0].specialArea == 1 ||
|
||||||
this.goodsCheck[0].specialArea == 24
|
this.goodsCheck[0].specialArea == 24
|
||||||
|
@ -548,11 +571,6 @@ export default {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
this.shopCarList = res.data
|
this.shopCarList = res.data
|
||||||
console.log(
|
|
||||||
'%c [ this.shopCarList ]-337',
|
|
||||||
'font-size:13px; background:#5f9b00; color:#a3df44;',
|
|
||||||
this.shopCarList
|
|
||||||
)
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue