|
|
@@ -86,11 +86,19 @@
|
|
|
<div class="sum">
|
|
|
<div class="sum_box" v-if="category_type === 1">
|
|
|
<div>Freight</div><!-- 运费 -->
|
|
|
- <div><span v-if="category_type === 1">{{ prefixSign }}</span> {{ payType === "cash" ? freight : pointFreight }} <span v-if="category_type === 1">{{ unit }}</span></div>
|
|
|
+ <div>
|
|
|
+ <span v-if="category_type === 1">{{ prefixSign }}</span>
|
|
|
+ {{ pointFreight }}
|
|
|
+ <span v-if="category_type === 1">{{ unit }}</span>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
<div class="sum_box">
|
|
|
<div>Amount paid</div><!-- 实付金额 -->
|
|
|
- <div><span v-if="category_type === 1">{{ prefixSign }}</span> {{ payType === "cash" ? cashSum : pointsSum }} <span v-if="category_type === 1">{{ unit }}</span></div>
|
|
|
+ <div>
|
|
|
+ <span v-if="category_type === 1">{{ prefixSign }}</span>
|
|
|
+ {{ payType === "cash" ? cashSum : pointsSum }}
|
|
|
+ <span v-if="category_type === 1">{{ unit }}</span>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -208,6 +216,7 @@
|
|
|
cashSum:'',
|
|
|
freight:'',
|
|
|
pointFreight:'',
|
|
|
+ freeShipping: '',
|
|
|
goodsId:'',
|
|
|
goodsNum:'',
|
|
|
payPassword:'',
|
|
|
@@ -244,10 +253,10 @@
|
|
|
components: {
|
|
|
paystack
|
|
|
},
|
|
|
- created(){
|
|
|
+ async created(){
|
|
|
let option= sessionStorage.getItem('order_goods');
|
|
|
this.category_type = parseInt(sessionStorage.getItem('category_type'))
|
|
|
- this.getShowCart();
|
|
|
+ await this.getShowCart();
|
|
|
if(option){
|
|
|
let pageGoodsList=JSON.parse(option);
|
|
|
// console.log(pageGoodsList);
|
|
|
@@ -272,7 +281,7 @@
|
|
|
})
|
|
|
}
|
|
|
|
|
|
- this.getSumMoney();
|
|
|
+ await this.getSumMoney();
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
@@ -289,10 +298,13 @@
|
|
|
cancelOrder(){
|
|
|
history.go(-1)
|
|
|
},
|
|
|
- setFreight(){
|
|
|
- if(this.addressId=='100000000000000000'){//如果地址为自提,则运费为0
|
|
|
- this.pointFreight = this.freight = 0;
|
|
|
- }
|
|
|
+ setFreight() {
|
|
|
+ //如果地址为自提,则运费为0
|
|
|
+ if (this.addressId == '100000000000000000') {
|
|
|
+ this.pointFreight = Number(0)
|
|
|
+ } else {
|
|
|
+ this.pointFreight = Number(this.freight)
|
|
|
+ }
|
|
|
},
|
|
|
getSummaries(param) {
|
|
|
const { columns, data } = param;
|
|
|
@@ -420,12 +432,13 @@
|
|
|
|
|
|
// 只有普通商品有运费
|
|
|
if (this.category_type === 1) {
|
|
|
- if(payAmount>=300){
|
|
|
- this.pointFreight = this.freight = 0;
|
|
|
- }else{
|
|
|
- this.pointFreight = this.freight = 15;
|
|
|
- }
|
|
|
+ // 商品自提,免运费
|
|
|
this.setFreight();
|
|
|
+ // 商品总价大于预定值,免运费
|
|
|
+ this.pointFreight = (this.pointFreight > 0) ? ((payAmount >= this.freeShipping) ? 0 : this.freight) : 0
|
|
|
+ } else {
|
|
|
+ // 非普通商品,没有运费
|
|
|
+ this.pointFreight = 0
|
|
|
}
|
|
|
// if(payPointAmount>=300){
|
|
|
// this.pointFreight = 0;
|
|
|
@@ -435,32 +448,35 @@
|
|
|
//console.log('points_plus_sum',points_plus_sum);
|
|
|
//console.log('cash_plus_sum',cash_plus_sum);
|
|
|
// this.pointsSum=tool.formatPrice(tool.sum(points_plus_sum) + this.pointFreight);
|
|
|
- this.pointsSum = this.cashSum = this.form.amount = tool.formatPrice(tool.sum(cash_plus_sum) + this.freight) ;
|
|
|
+ this.pointsSum = this.cashSum = this.form.amount = tool.formatPrice(tool.sum(cash_plus_sum) + this.pointFreight) ;
|
|
|
},
|
|
|
- getShowCart(){
|
|
|
- network.getData('shop/show-cart', { categoryType: this.categoryType })
|
|
|
- .then(response => {
|
|
|
+ async getShowCart() {
|
|
|
+ await network.getData('shop/show-cart', {categoryType: this.categoryType}).then(response => {
|
|
|
this.loading = false
|
|
|
// 收货地址
|
|
|
this.all_address = response.allAddress;
|
|
|
- this.all_address.map((item,index)=>{
|
|
|
- if(item.IS_DEFAULT==1){
|
|
|
- this.addressId = item.ID
|
|
|
- }
|
|
|
+ this.all_address.map((item, index) => {
|
|
|
+ if (item.IS_DEFAULT == 1) {
|
|
|
+ this.addressId = item.ID
|
|
|
+ }
|
|
|
})
|
|
|
// 账户
|
|
|
this.balance = response.userBalance
|
|
|
|
|
|
// 支付方式
|
|
|
for (let item of response.sellType) {
|
|
|
- if (item.id === this.category_type) {
|
|
|
- this.payList = item.sell_type
|
|
|
- break
|
|
|
- }
|
|
|
+ if (item.id === this.category_type) {
|
|
|
+ this.payList = item.sell_type
|
|
|
+ break
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// 支付方式的第一项默认选中
|
|
|
this.payType = Object.values(this.payList)[0]['label']
|
|
|
+ // 免运费阈值
|
|
|
+ this.freeShipping = response.freeShipping
|
|
|
+ // 运费
|
|
|
+ this.freight = response.freight
|
|
|
})
|
|
|
},
|
|
|
// 切换支付方式
|
|
|
@@ -468,7 +484,9 @@
|
|
|
this.payType = type
|
|
|
},
|
|
|
choseAddress(addressId){
|
|
|
- this.getSumMoney()
|
|
|
+ this.addressId = addressId
|
|
|
+ this.setFreight()
|
|
|
+ this.getSumMoney()
|
|
|
},
|
|
|
// 关闭支付回调
|
|
|
handleClose() {
|
|
|
@@ -525,7 +543,7 @@
|
|
|
}
|
|
|
}, 1000)
|
|
|
},
|
|
|
- }
|
|
|
+ },
|
|
|
}
|
|
|
</script>
|
|
|
|