Browse Source

增加环境配置

master
xh-pan1 2 years ago
parent
commit
3a05cbfcd6
  1. 5
      src/util/server.js
  2. 2
      src/views/placeOrder/components/shopOrder.vue
  3. 59
      src/views/placeOrder/index.vue

5
src/util/server.js

@ -8,7 +8,10 @@ import Cookie from 'js-cookie'
promise.polyfill()
export const baseURL = (process.env.NODE_ENV === 'production') ? 'http://122.9.152.120/ceres-app-api' : '/api'
export const uploadURL = 'https://ceres.zkthink.com/api'
export const uploadURL = 'http://122.9.152.120/ceres-app-api/api'
// export const baseURL = (process.env.NODE_ENV === 'production') ? 'http://14.22.116.132:81/ceres-app-api' : '/api'
// export const uploadURL = 'http://14.22.116.132:81/ceres-app-api/api'
const service = axios.create({
baseURL,

2
src/views/placeOrder/components/shopOrder.vue

@ -38,7 +38,7 @@
<div class="totalBox flex1">{{order.total}}</div>
</div>
</div>
<div v-if="shopsData.receiveNotMatch" class="adressTips">当前地址不支持配送可更换其他地址试试</div>
<div v-if="shopsData.receiveNotMatch" class="adressTips">当前地址不支持配送可更换其他地址试试</div>
<slot name="coupon"></slot>
<div class="remarksBox">
<div class="remarksInfo">

59
src/views/placeOrder/index.vue

@ -27,7 +27,7 @@
<div class="shoplist">
<div class="shopTitle">请确认订单信息</div>
<ShopOrder v-for="item in this.settlement.shops"
:key="item.shopId"
:key="item.uniqueId"
:type="state"
:shopsData="item"
>
@ -327,9 +327,9 @@ export default {
...mapGetters([
'newAddress' //
]),
shopIds () {
uniqueIds () {
return this.settlement.shops.map(item => {
return item.shopId
return item.uniqueId
})
}
},
@ -533,6 +533,7 @@ export default {
this.settlement = res.data
this.currentAddressId = res.data.receive.receiveId || ''
this.settlement.shops = res.data.shops || [] //
//
this.settlement.coupons.forEach((item, index) => {
item.index = index
item.type = 1
@ -550,7 +551,8 @@ export default {
item.shopCoupons = item.shopCoupons.map((i, index) => {
i.index = index
i.type = 2 // type 1 2
i.uniWebId = `${item.shopId}+${index}` //
i.uniWebId = `${item.uniqueId}+${index}` //
i.uniqueId = item.uniqueId
i.shopId = item.shopId // 便
i.discountAmount = 0
return i
@ -571,25 +573,32 @@ export default {
// uniapp
shopCouponItemTap (coupon) {
const index = coupon.index
this.shopIndex = this.shopIds.indexOf(coupon.shopId)
//
this.shopIndex = this.uniqueIds.indexOf(coupon.uniqueId)
var checkShop = this.settlement.shops[this.shopIndex]
//
if (coupon.checked) {
coupon.checked = false
coupon.discountAmount = 0
this.settlement.shops[this.shopIndex].totalAfterDiscount = this.settlement.shops[this.shopIndex].total
this.settlement.shops[this.shopIndex].currentCoupon = {}
this.settlement.shops[this.shopIndex].skus.forEach(item => {
checkShop.totalAfterDiscount = checkShop.total
checkShop.currentCoupon = {}
checkShop.skus.forEach(item => {
item.buyerShopCouponId = null
})
this.selectShopCoupon = []
this.selectShopCoupon.splice(this.selectShopCoupon.indexOf(coupon), 1)
this.getTotal()
return false
}
if (this.settlement.shops[this.shopIndex].total < coupon.fullMoney) {
for (let i = 0; i < this.selectShopCoupon.length; i++) {
if (this.selectShopCoupon[i].id === coupon.id) {
this.$message.warning('优惠券不能重复使用!')
return false
}
}
if (checkShop.total < coupon.fullMoney) {
this.$message.warning('不满足优惠券使用条件!')
} else if (coupon.couponType === 1 && this.settlement.shops[this.shopIndex].total < coupon.reduceMoney) {
} else if (coupon.couponType === 1 && checkShop.total < coupon.reduceMoney) {
this.$message.warning('不可使用大于商品金额的优惠劵!')
} else {
//
@ -598,7 +607,7 @@ export default {
return false
}
if (coupon.couponType === 1) {
if (coupon.reduceMoney >= this.settlement.shops[this.shopIndex].total) {
if (coupon.reduceMoney >= checkShop.total) {
this.$message.warning('优惠券优惠金额不能大于等于合计金额!')
return false
}
@ -608,23 +617,30 @@ export default {
this.shopCouIndex = index
let useCoupon = this.useShopCoupon(this.shopIndex, this.shopCouIndex)
if (useCoupon) {
let otherSelectShopCoupon
// 使
for (let i = 0; i < this.selectShopCoupon.length; i++) {
this.selectShopCoupon[i].checked = false
if (this.selectShopCoupon[i].uniqueId === coupon.uniqueId) {
this.selectShopCoupon[i].checked = false
otherSelectShopCoupon = this.selectShopCoupon[i]
break
}
}
if (otherSelectShopCoupon != null) {
this.selectShopCoupon.splice(this.selectShopCoupon.indexOf(otherSelectShopCoupon), 1)
}
this.selectShopCoupon = []
coupon.checked = true
this.settlement.shops[this.shopIndex].id = coupon.id
this.settlement.shops[this.shopIndex].currentCoupon = coupon
this.settlement.shops[this.shopIndex].skus.forEach(item => {
checkShop.id = coupon.id
checkShop.currentCoupon = coupon
checkShop.skus.forEach(item => {
if (item.buyerShopCouponId > 0 && item.buyerShopCouponId !== coupon.shopCouponId) {
item.buyerShopCouponId = null
}
})
this.selectShopCoupon.push(coupon)
} else {
this.settlement.shops[this.shopIndex].totalAfterDiscount = this.settlement.shops[this.shopIndex].total
checkShop.totalAfterDiscount = checkShop.total
}
this.getTotal()
}
@ -691,7 +707,7 @@ export default {
}
totalPrice += matchCouponNormalPrice
}
if (this.settlement.shops[this.shopIndex].total < coupon.fullMoney) {
if (totalPrice < coupon.fullMoney) {
this.$message.warning('不满足优惠券使用条件!')
}
if (coupon.couponType === 1 && coupon.reduceMoney >= totalPrice) {
@ -917,7 +933,10 @@ export default {
if (skus.length) {
shops.push({
id: j.id,
uniqueId: j.uniqueId,
isCross: j.isCross,
shopId: j.shopId,
storehouseId: j.storehouseId,
remark: j.remark,
distribution: {
distributionPrice: j.distribution.distributionPrice,

Loading…
Cancel
Save