|
@@ -1,31 +1,19 @@
|
|
<template>
|
|
<template>
|
|
- <view class="container order clearfix" :style="{ paddingBottom: isIphoneX ? '170rpx' : '134rpx' }">
|
|
|
|
|
|
+ <view class="container order clearfix" :style="{ paddingBottom: isIphoneX ? '200rpx' : '164rpx' }">
|
|
<!-- 地址选择 -->
|
|
<!-- 地址选择 -->
|
|
- <choice-address ref="choiceAddress" v-if="isAddress" :addressData="addressData"></choice-address>
|
|
|
|
|
|
+ <choice-address ref="choiceAddress" v-if="isAddress" :addressData="addressData" />
|
|
<!-- 商品 -->
|
|
<!-- 商品 -->
|
|
- <goods-list
|
|
|
|
- ref="goods"
|
|
|
|
- v-if="isRequest"
|
|
|
|
- :goodsData="goodsData"
|
|
|
|
- @handleGoodList="handChangeInputGoodsList"
|
|
|
|
- ></goods-list>
|
|
|
|
|
|
+ <goods-list ref="goods" v-if="isRequest" :goodsData="goodsData" @handleGoodList="handChangeInputGoodsList" />
|
|
<!-- 发票信息 -->
|
|
<!-- 发票信息 -->
|
|
<invoice-tent
|
|
<invoice-tent
|
|
ref="invoice"
|
|
ref="invoice"
|
|
v-if="isRequest"
|
|
v-if="isRequest"
|
|
:invoiceDatas="invoiceData"
|
|
:invoiceDatas="invoiceData"
|
|
@handleChoiceaInvoice="handleChoiceaInvoiceData"
|
|
@handleChoiceaInvoice="handleChoiceaInvoiceData"
|
|
- >
|
|
|
|
- </invoice-tent>
|
|
|
|
|
|
+ />
|
|
<!-- 运费 -->
|
|
<!-- 运费 -->
|
|
- <freight
|
|
|
|
- ref="freight"
|
|
|
|
- v-if="isFreight"
|
|
|
|
- :freightData="freightData"
|
|
|
|
- @confirmFreight="hanldFreightFn"
|
|
|
|
- >
|
|
|
|
- </freight>
|
|
|
|
- <freight-alert v-if="isfreightTip" ref="csPhone"></freight-alert>
|
|
|
|
|
|
+ <freight ref="freight" v-if="isFreight" :freightData="freightData" :coldChain="handleColdChain" @confirmFreight="hanldFreightFn" />
|
|
|
|
+ <freight-alert v-if="isfreightTip" ref="csPhone" />
|
|
<!-- 底部 -->
|
|
<!-- 底部 -->
|
|
<view class="footer-wrapper" :style="{ paddingBottom: isIphoneX ? '68rpx' : '0rpx' }">
|
|
<view class="footer-wrapper" :style="{ paddingBottom: isIphoneX ? '68rpx' : '0rpx' }">
|
|
<view class="footer">
|
|
<view class="footer">
|
|
@@ -75,6 +63,7 @@ export default {
|
|
},
|
|
},
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
|
|
+ skeletonShow: true,
|
|
isIphoneX: this.$store.state.isIphoneX,
|
|
isIphoneX: this.$store.state.isIphoneX,
|
|
isSubLoading: false,
|
|
isSubLoading: false,
|
|
confirmType: 1,
|
|
confirmType: 1,
|
|
@@ -115,6 +104,7 @@ export default {
|
|
orderInvoice: { type: 0 }, // 订单发票信息
|
|
orderInvoice: { type: 0 }, // 订单发票信息
|
|
payInfo: {
|
|
payInfo: {
|
|
// 订单金额数据
|
|
// 订单金额数据
|
|
|
|
+ isColdChina:1, //是否勾选冷链费
|
|
orderShouldPayFee: 0, // 订单最终支付金额
|
|
orderShouldPayFee: 0, // 订单最终支付金额
|
|
balancePayFlag: 0, // 勾选余额的状态(1使用,0不使用)
|
|
balancePayFlag: 0, // 勾选余额的状态(1使用,0不使用)
|
|
clauseId: 0, // 条款Id
|
|
clauseId: 0, // 条款Id
|
|
@@ -135,6 +125,7 @@ export default {
|
|
isAddress: false, // 是否加载完成地址
|
|
isAddress: false, // 是否加载完成地址
|
|
isExchangePopup: false, // 控制兑换优惠券弹窗
|
|
isExchangePopup: false, // 控制兑换优惠券弹窗
|
|
isfreightTip: false, // 控制邮费弹窗
|
|
isfreightTip: false, // 控制邮费弹窗
|
|
|
|
+ designatedFlag: '', // 是否为指定商品 1.仅为指定商品 2.仅为供应商商品 3.指定商品+供应商商品
|
|
hanldFreePostFlag: '', // 邮费状态
|
|
hanldFreePostFlag: '', // 邮费状态
|
|
hanldFreight: '', // 邮费
|
|
hanldFreight: '', // 邮费
|
|
addressData: {}, // 初始化地址信息
|
|
addressData: {}, // 初始化地址信息
|
|
@@ -143,7 +134,8 @@ export default {
|
|
invoiceData: { type: 0 }, // 初始化发票信息
|
|
invoiceData: { type: 0 }, // 初始化发票信息
|
|
freightData: {}, // 邮费数据
|
|
freightData: {}, // 邮费数据
|
|
orderInfo: [], // 提交的商品信息
|
|
orderInfo: [], // 提交的商品信息
|
|
- freightBeansMoney: 0, // 存储采美豆抵扣金额
|
|
|
|
|
|
+ handleColdChain:0,// 指定商品冷链费
|
|
|
|
+ freightColdChain: 0, // 存储冷链费
|
|
contentModalText: '采购金额过小,将扣除500采美豆,建议您前往采美旗下“颜选美学”小程序购买小额商品。', //操作文字提示语句
|
|
contentModalText: '采购金额过小,将扣除500采美豆,建议您前往采美旗下“颜选美学”小程序购买小额商品。', //操作文字提示语句
|
|
modalButton: [
|
|
modalButton: [
|
|
{
|
|
{
|
|
@@ -161,12 +153,12 @@ export default {
|
|
}
|
|
}
|
|
],
|
|
],
|
|
showModal: false,
|
|
showModal: false,
|
|
- showModalstauts: 0,
|
|
|
|
|
|
+ showModalstauts: 0
|
|
}
|
|
}
|
|
},
|
|
},
|
|
onLoad(option) {
|
|
onLoad(option) {
|
|
//商品数据
|
|
//商品数据
|
|
- this.initStorage(option)
|
|
|
|
|
|
+ this.initCreateOrderInfo(option)
|
|
},
|
|
},
|
|
filters: {
|
|
filters: {
|
|
NumFormat(value) {
|
|
NumFormat(value) {
|
|
@@ -175,14 +167,12 @@ export default {
|
|
}
|
|
}
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
- async initStorage(option) {
|
|
|
|
|
|
+ async initCreateOrderInfo(option) {
|
|
const data = JSON.parse(option.data)
|
|
const data = JSON.parse(option.data)
|
|
const userInfo = await this.$api.getStorage()
|
|
const userInfo = await this.$api.getStorage()
|
|
- console.log('data', data)
|
|
|
|
- this.productParam.userId = this.cartParam.userId = this.supportParm.userId = this.postageParam.userId = userInfo.userId
|
|
|
|
- ? userInfo.userId
|
|
|
|
- : 0
|
|
|
|
- this.confirmParam.clubId = userInfo.clubId ? userInfo.clubId : 0
|
|
|
|
|
|
+ this.productParam.userId = this.cartParam.userId = userInfo.userId
|
|
|
|
+ this.supportParm.userId = this.postageParam.userId = userInfo.userId
|
|
|
|
+ this.confirmParam.clubId = userInfo.clubId
|
|
switch (option.type) {
|
|
switch (option.type) {
|
|
case '1': // 商品详情立即购买
|
|
case '1': // 商品详情立即购买
|
|
this.confirmParam.cartType = 2
|
|
this.confirmParam.cartType = 2
|
|
@@ -207,28 +197,28 @@ export default {
|
|
},
|
|
},
|
|
// 商品立即购买确认订单数据初始化
|
|
// 商品立即购买确认订单数据初始化
|
|
async GetProductCreateOrderInfo() {
|
|
async GetProductCreateOrderInfo() {
|
|
- try{
|
|
|
|
|
|
+ try {
|
|
const res = await this.OrderService.ProductCreateOrderInfo(this.productParam)
|
|
const res = await this.OrderService.ProductCreateOrderInfo(this.productParam)
|
|
this.setCreatDataInfo(res.data)
|
|
this.setCreatDataInfo(res.data)
|
|
- }catch(error){
|
|
|
|
|
|
+ } catch (error) {
|
|
console.log('商品立即购买订单初始化异常')
|
|
console.log('商品立即购买订单初始化异常')
|
|
}
|
|
}
|
|
},
|
|
},
|
|
// 组合商品立即购买确认订单数据初始化
|
|
// 组合商品立即购买确认订单数据初始化
|
|
async GetOrderClubProductSupporting() {
|
|
async GetOrderClubProductSupporting() {
|
|
- try{
|
|
|
|
|
|
+ try {
|
|
const res = await this.OrderService.OrderClubProductSupporting(this.supportParm)
|
|
const res = await this.OrderService.OrderClubProductSupporting(this.supportParm)
|
|
this.setCreatDataInfo(res.data)
|
|
this.setCreatDataInfo(res.data)
|
|
- }catch(error){
|
|
|
|
|
|
+ } catch (error) {
|
|
console.log('组合商品立即购买订单初始化异常')
|
|
console.log('组合商品立即购买订单初始化异常')
|
|
}
|
|
}
|
|
},
|
|
},
|
|
// 购物车去结算确认订单数据初始化
|
|
// 购物车去结算确认订单数据初始化
|
|
async CartCreateOrderInfo() {
|
|
async CartCreateOrderInfo() {
|
|
- try{
|
|
|
|
|
|
+ try {
|
|
const res = await this.OrderService.CartCreateOrderInfo(this.cartParam)
|
|
const res = await this.OrderService.CartCreateOrderInfo(this.cartParam)
|
|
this.setCreatDataInfo(res.data)
|
|
this.setCreatDataInfo(res.data)
|
|
- }catch(error){
|
|
|
|
|
|
+ } catch (error) {
|
|
console.log('购物车结算订单初始化异常')
|
|
console.log('购物车结算订单初始化异常')
|
|
}
|
|
}
|
|
},
|
|
},
|
|
@@ -237,6 +227,7 @@ export default {
|
|
this.isRequest = true
|
|
this.isRequest = true
|
|
this.goodsData = data.list
|
|
this.goodsData = data.list
|
|
this.couponList = data.couponList
|
|
this.couponList = data.couponList
|
|
|
|
+ this.handleColdChain = this.freightColdChain = data.coldChain
|
|
this.userMoney = data.userMoney
|
|
this.userMoney = data.userMoney
|
|
this.totalCount = data.totalCount
|
|
this.totalCount = data.totalCount
|
|
this.allPrice = data.totalPrice
|
|
this.allPrice = data.totalPrice
|
|
@@ -257,40 +248,28 @@ export default {
|
|
},
|
|
},
|
|
// 获取邮费信息
|
|
// 获取邮费信息
|
|
async getFreightData() {
|
|
async getFreightData() {
|
|
- try{
|
|
|
|
|
|
+ try {
|
|
this.isFreight = false
|
|
this.isFreight = false
|
|
const res = await this.OrderService.GetOrderPostage(this.postageParam)
|
|
const res = await this.OrderService.GetOrderPostage(this.postageParam)
|
|
const data = res.data
|
|
const data = res.data
|
|
this.isFreight = true
|
|
this.isFreight = true
|
|
this.freightData = data
|
|
this.freightData = data
|
|
|
|
+ this.designatedFlag = data.designatedFlag
|
|
this.hanldFreePostFlag = data.postageFlag
|
|
this.hanldFreePostFlag = data.postageFlag
|
|
this.hanldFreight = data.postage
|
|
this.hanldFreight = data.postage
|
|
- if (this.hanldFreePostFlag == 1) {
|
|
|
|
- if (this.freightData.userBeans > 0) {
|
|
|
|
- this.freightBeansMoney = this.hanldFreight
|
|
|
|
- } else {
|
|
|
|
- this.freightBeansMoney = 0
|
|
|
|
- }
|
|
|
|
- this.orderShouldPayFee = this.allPrice + data.postage
|
|
|
|
- this.attributePallPrice()
|
|
|
|
- } else {
|
|
|
|
- if (this.freightData.userBeans > 0) {
|
|
|
|
- this.freightBeansMoney = 30
|
|
|
|
- } else {
|
|
|
|
- this.freightBeansMoney = 0
|
|
|
|
- }
|
|
|
|
- this.orderShouldPayFee = this.allPrice
|
|
|
|
- this.attributePallPrice()
|
|
|
|
- }
|
|
|
|
- }catch(error){
|
|
|
|
|
|
+ this.attributePallPrice()
|
|
|
|
+ } catch (error) {
|
|
console.log('获取订单运费异常')
|
|
console.log('获取订单运费异常')
|
|
}
|
|
}
|
|
},
|
|
},
|
|
//获取地址信息
|
|
//获取地址信息
|
|
async getAddressData() {
|
|
async getAddressData() {
|
|
- try{
|
|
|
|
- const userInfo = await this.$api.getStorage()
|
|
|
|
- const res = await this.UserService.QueryAddressList({ pageNum: 1,pageSize: 1,userId: this.postageParam.userId })
|
|
|
|
|
|
+ try {
|
|
|
|
+ const res = await this.UserService.QueryAddressList({
|
|
|
|
+ pageNum: 1,
|
|
|
|
+ pageSize: 1,
|
|
|
|
+ userId: this.postageParam.userId
|
|
|
|
+ })
|
|
const data = res.data
|
|
const data = res.data
|
|
this.isAddress = true
|
|
this.isAddress = true
|
|
this.addressData = {}
|
|
this.addressData = {}
|
|
@@ -302,8 +281,8 @@ export default {
|
|
} else {
|
|
} else {
|
|
this.addressData = this.addressData
|
|
this.addressData = this.addressData
|
|
}
|
|
}
|
|
- }catch(error){
|
|
|
|
- console.log('error',error)
|
|
|
|
|
|
+ } catch (error) {
|
|
|
|
+ console.log('error', error)
|
|
}
|
|
}
|
|
},
|
|
},
|
|
//对应供应商的留言信息
|
|
//对应供应商的留言信息
|
|
@@ -314,32 +293,35 @@ export default {
|
|
handleChoiceaInvoiceData(data) {
|
|
handleChoiceaInvoiceData(data) {
|
|
this.confirmParam.orderInvoice = data
|
|
this.confirmParam.orderInvoice = data
|
|
},
|
|
},
|
|
- //显示邮费弹窗
|
|
|
|
- hanldFreightFn(data) {
|
|
|
|
- console.log('邮费信息', data)
|
|
|
|
- switch (data.postageFlag) {
|
|
|
|
- case 1:
|
|
|
|
- this.hanldFreight = this.freightData.postage
|
|
|
|
- this.hanldFreePostFlag = data.postageFlag
|
|
|
|
- this.freightBeansMoney = data.freightBeansMoney
|
|
|
|
- this.orderShouldPayFee = this.allPrice + this.hanldFreight
|
|
|
|
- this.attributePallPrice()
|
|
|
|
- break
|
|
|
|
- case -1:
|
|
|
|
- this.hanldFreight = 0
|
|
|
|
- this.hanldFreePostFlag = data.postageFlag
|
|
|
|
- this.freightBeansMoney = data.freightBeansMoney
|
|
|
|
- this.orderShouldPayFee = this.allPrice
|
|
|
|
- this.attributePallPrice()
|
|
|
|
- break
|
|
|
|
|
|
+ hanldFreightFn(ischecked){//是否勾选冷链费
|
|
|
|
+ this.confirmParam.payInfo.isColdChina = ischecked ? 1 : 0
|
|
|
|
+ if(ischecked){
|
|
|
|
+ this.freightColdChain = this.handleColdChain
|
|
|
|
+ }else{// 不勾选冷链费计算总价
|
|
|
|
+ this.freightColdChain = 0
|
|
}
|
|
}
|
|
|
|
+ this.attributePallPrice()
|
|
},
|
|
},
|
|
// 计算价格
|
|
// 计算价格
|
|
attributePallPrice() {
|
|
attributePallPrice() {
|
|
- if (this.hanldFreePostFlag == 1 || this.hanldFreePostFlag == '1') {
|
|
|
|
- this.attributeHashfreight(this.freightData.postage)
|
|
|
|
- } else {
|
|
|
|
- this.attributeNofreight()
|
|
|
|
|
|
+ switch(this.designatedFlag){
|
|
|
|
+ case 1://仅为指定商品
|
|
|
|
+ this.attributeChainfreight()
|
|
|
|
+ break
|
|
|
|
+ case 2:// 仅为供应商商品
|
|
|
|
+ if (this.hanldFreePostFlag == 1) {
|
|
|
|
+ this.attributeHashfreight(this.freightData.postage)
|
|
|
|
+ } else {
|
|
|
|
+ this.attributeNofreight()
|
|
|
|
+ }
|
|
|
|
+ break
|
|
|
|
+ case 3:// 有指定商品 + 供应商商品
|
|
|
|
+ if (this.hanldFreePostFlag == 1) {
|
|
|
|
+ this.attributeHashChainfreight(this.freightData.postage)
|
|
|
|
+ } else {
|
|
|
|
+ this.attributeChainfreight()
|
|
|
|
+ }
|
|
|
|
+ break
|
|
}
|
|
}
|
|
},
|
|
},
|
|
// 计算没有邮费的支付价格
|
|
// 计算没有邮费的支付价格
|
|
@@ -347,9 +329,19 @@ export default {
|
|
this.orderShouldPayFee = this.allPrice
|
|
this.orderShouldPayFee = this.allPrice
|
|
console.log('最终订单支付金额', this.orderShouldPayFee)
|
|
console.log('最终订单支付金额', this.orderShouldPayFee)
|
|
},
|
|
},
|
|
|
|
+ // 计算仅为指定商品冷链费的价格
|
|
|
|
+ attributeChainfreight(){
|
|
|
|
+ this.orderShouldPayFee = this.allPrice + this.freightColdChain
|
|
|
|
+ console.log('最终订单支付金额', this.orderShouldPayFee)
|
|
|
|
+ },
|
|
|
|
+ // 计算指定商品冷链费后+运费的支付价格
|
|
|
|
+ attributeHashChainfreight(postage){
|
|
|
|
+ this.orderShouldPayFee = this.allPrice + this.freightColdChain + parseInt(postage)
|
|
|
|
+ console.log('最终订单支付金额', this.orderShouldPayFee)
|
|
|
|
+ },
|
|
// 计算需要邮费的支付价格
|
|
// 计算需要邮费的支付价格
|
|
attributeHashfreight(postage) {
|
|
attributeHashfreight(postage) {
|
|
- this.orderShouldPayFee = this.allPrice + parseInt(postage) //计算不包邮的价格 总价等于商品价格+邮费
|
|
|
|
|
|
+ this.orderShouldPayFee = this.allPrice + parseInt(postage) //计算不包邮的价格 总价等于商品价格+邮费
|
|
console.log('最终订单支付金额', this.orderShouldPayFee)
|
|
console.log('最终订单支付金额', this.orderShouldPayFee)
|
|
},
|
|
},
|
|
// 提交订单按钮点击事件
|
|
// 提交订单按钮点击事件
|
|
@@ -358,7 +350,9 @@ export default {
|
|
},
|
|
},
|
|
// 提交订单
|
|
// 提交订单
|
|
handleClickOrderSubmitMit() {
|
|
handleClickOrderSubmitMit() {
|
|
- if (this.isSubLoading) { return }
|
|
|
|
|
|
+ if (this.isSubLoading) {
|
|
|
|
+ return
|
|
|
|
+ }
|
|
if (this.confirmParam.addressId == '') {
|
|
if (this.confirmParam.addressId == '') {
|
|
this.$util.msg('请先添加收货地址~', 2000)
|
|
this.$util.msg('请先添加收货地址~', 2000)
|
|
return
|
|
return
|
|
@@ -392,8 +386,8 @@ export default {
|
|
},
|
|
},
|
|
async hanldeOrderSubmit(params) {
|
|
async hanldeOrderSubmit(params) {
|
|
// 提交订单
|
|
// 提交订单
|
|
- try{
|
|
|
|
- const res =await this.OrderService.CreatedOrderSubmit(params)
|
|
|
|
|
|
+ try {
|
|
|
|
+ const res = await this.OrderService.CreatedOrderSubmit(params)
|
|
const data = res.data
|
|
const data = res.data
|
|
if (data.code === 1) {
|
|
if (data.code === 1) {
|
|
this.submitState = 'success'
|
|
this.submitState = 'success'
|
|
@@ -415,13 +409,14 @@ export default {
|
|
}
|
|
}
|
|
}, 2000)
|
|
}, 2000)
|
|
}
|
|
}
|
|
- }catch(error){
|
|
|
|
|
|
+ } catch (error) {
|
|
console.log(error)
|
|
console.log(error)
|
|
this.formatConfirmParam()
|
|
this.formatConfirmParam()
|
|
this.isSubLoading = false
|
|
this.isSubLoading = false
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- formatConfirmParam(){// 还原提交订单参数格式
|
|
|
|
|
|
+ formatConfirmParam() {
|
|
|
|
+ // 还原提交订单参数格式
|
|
this.confirmParam.payInfo = JSON.parse(this.confirmParam.payInfo)
|
|
this.confirmParam.payInfo = JSON.parse(this.confirmParam.payInfo)
|
|
this.confirmParam.orderInfo = JSON.parse(this.confirmParam.orderInfo)
|
|
this.confirmParam.orderInfo = JSON.parse(this.confirmParam.orderInfo)
|
|
this.confirmParam.orderInvoice = JSON.parse(this.confirmParam.orderInvoice)
|
|
this.confirmParam.orderInvoice = JSON.parse(this.confirmParam.orderInvoice)
|
|
@@ -488,7 +483,7 @@ export default {
|
|
this.postageParam.townId = SelectData.townId
|
|
this.postageParam.townId = SelectData.townId
|
|
this.addressData = SelectData
|
|
this.addressData = SelectData
|
|
this.getFreightData()
|
|
this.getFreightData()
|
|
- }else{
|
|
|
|
|
|
+ } else {
|
|
this.getAddressData()
|
|
this.getAddressData()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -512,16 +507,6 @@ page {
|
|
.order {
|
|
.order {
|
|
padding-bottom: 134rpx;
|
|
padding-bottom: 134rpx;
|
|
}
|
|
}
|
|
-.invoice-freight {
|
|
|
|
- width: 702rpx;
|
|
|
|
- padding: 0 24rpx;
|
|
|
|
- height: auto;
|
|
|
|
- font-size: $font-size-28;
|
|
|
|
- color: $text-color;
|
|
|
|
- background: #ffffff;
|
|
|
|
- float: left;
|
|
|
|
- font-weight: bold;
|
|
|
|
-}
|
|
|
|
.invoice-balance {
|
|
.invoice-balance {
|
|
width: 702rpx;
|
|
width: 702rpx;
|
|
height: auto;
|
|
height: auto;
|
|
@@ -612,7 +597,6 @@ page {
|
|
.footer-count {
|
|
.footer-count {
|
|
float: left;
|
|
float: left;
|
|
padding-left: 24rpx;
|
|
padding-left: 24rpx;
|
|
- width: 180rpx;
|
|
|
|
box-sizing: border-box;
|
|
box-sizing: border-box;
|
|
}
|
|
}
|
|
.footer-price {
|
|
.footer-price {
|