You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1134 lines
30 KiB
1134 lines
30 KiB
<template>
|
|
<view>
|
|
<view class="address" @click="goAddress">
|
|
<view class="address_left">
|
|
<view class="address_title">
|
|
<image src="../../static/img/address.png" mode=""></image>
|
|
<view class="address_title_name" v-if="address">{{address.consignee}}</view>
|
|
<text v-if="address">{{address.mobile}}</text>
|
|
|
|
</view>
|
|
<view class="address_content" v-if="address">
|
|
{{address.sign_building}}
|
|
{{address.country_name}}{{address.province_name}}{{address.city_name}}{{address.address}}{{address.zipcode}}
|
|
</view>
|
|
<view class="address_title" v-if="!address">Add Shipping Address</view>
|
|
</view>
|
|
|
|
<image src="../../static/img/right.png" class="address_more"></image>
|
|
<image src="../../static/img/address_xian.png" class="address_xian" mode=""></image>
|
|
</view>
|
|
|
|
<view class="order_info" @click="popup_good=true, openMore(0)">
|
|
<view class="info_title">
|
|
<text>Items in cart</text>
|
|
<view class="info_title_right" @click="openMore(0)">
|
|
<text>{{goods_list.length}} ltems</text>
|
|
<image src="../../static/img/right.png" class="address_more"></image>
|
|
</view>
|
|
</view>
|
|
<view class="info_image img_border">
|
|
<image class="info_image_item img_border" :src="item.goods_thumb" v-for="(item,index) in goods_list"
|
|
:key="index" />
|
|
</view>
|
|
</view>
|
|
|
|
<view class="method">
|
|
<view class="method_title">Shipping Method</view>
|
|
|
|
<view class="method_item" v-for="(item,index) in shipping_list " :key="index"
|
|
@click="cartselectshipping(item.shipping_id)">
|
|
<view class="method_item_image" @click="cartselectshipping(item.shipping_id)">
|
|
<image src="../../static/img/select1.png" style="width: 30rpx;height: 30rpx;"
|
|
v-if="orderId==item.shipping_id"></image>
|
|
<image src="../../static/img/select2.png" style="width: 30rpx;height: 30rpx;" v-else></image>
|
|
</view>
|
|
|
|
<view class="method_item_right">
|
|
<view class="item_price">
|
|
<text>{{item.shipping_name}}:</text>
|
|
<text class="item_price_span">US${{item.shipping_fee}}</text>
|
|
</view>
|
|
<view class="item_time">
|
|
<text class="item_time_span">{{item.shipping_desc}} </text>
|
|
<!-- <text> 15/05/2022-04/05/2022</text> -->
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
<view class="discount">
|
|
<view class="discount_item" @click="openMore(1)">
|
|
<text>Coupons</text>
|
|
<view class="discount_item_right">
|
|
<text v-if="bonus>0 ||bonus!=0">-US${{bonus}}</text>
|
|
<!-- <text v-if="isusebonus == 0">No available</text> -->
|
|
<image src="../../static/img/right.png" mode="" class="address_more"></image>
|
|
</view>
|
|
</view>
|
|
<view class="discount_item" @click="openMore(3)">
|
|
<view class="discount_item_left">
|
|
<text>Points</text>
|
|
<text class="discount_item_left_span">({{count}})</text>
|
|
</view>
|
|
<view class="discount_item_right">
|
|
<text v-if="use&&Points >0 ">-US${{ Points}}</text>
|
|
<image src="../../static/img/right.png" mode="" class="address_more"></image>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
<view class="settlement">
|
|
<view class="settlement_item">
|
|
<text>Subtotal:</text>
|
|
<text class="settlement_item_right">US${{total.goods_price}}</text>
|
|
</view>
|
|
<view class="settlement_item">
|
|
<text>Shipping fee:</text>
|
|
<text class="settlement_item_right">US${{total.shipping_fee}}</text>
|
|
</view>
|
|
<view class="settlement_item">
|
|
<text>Discount :</text>
|
|
<text class="settlement_item_right1">-US${{bonus || 0}}</text>
|
|
</view>
|
|
</view>
|
|
|
|
<view class="total">
|
|
<text>Total: US${{total.amount - bonus}}</text>
|
|
<button @click="place()">PLACE ORDER</button>
|
|
</view>
|
|
|
|
<view class="mask" v-show="isShow" @click="isShow=false"></view>
|
|
<view class="order_popup" v-show="isShow">
|
|
<view class="order_popup_title">
|
|
<!-- <text>
|
|
{{popup_index==0?'Commodity information':popup_index==1?'Coupons':popup_index==2?'Payment Method':'Points'}}<text v-show="popup_index==3">(total:<text class="order_popup_title_span" >{{orderDate.your_integral || 0}}</text>)</text>
|
|
</text> -->
|
|
<text>
|
|
Payment Method</text>
|
|
</text>
|
|
<image src="../../static/img/close1.png" mode="" @click="isShow=false"></image>
|
|
</view>
|
|
|
|
|
|
|
|
<!-- <view class="order_popup_coupons" v-show="popup_index==1">
|
|
<view class="coupons_item" v-for="(item,index) in bonus_list " :key="item.bonus_id">
|
|
<view class="coupons_item_left">
|
|
<view class="item_left_prcie">${{item.type_money}}</view>
|
|
<text class="item_left_span">Min.spend</text>
|
|
<view>$200.00</view>
|
|
</view>
|
|
<view class="coupons_item_right">
|
|
<view class="coupons_right_info">
|
|
<view class="coupons_right_info_title">{{item.type_name}}</view>
|
|
<text>The tide zone is available</text>
|
|
<view class="coupons_right_info_time">2022.09.23 10:37 - 2022.12.23 10:37</view>
|
|
</view>
|
|
<button @click="useCoupons(item.bonus_id)">Use Now</button>
|
|
<image src="../../static/img/select3.png" mode="" class="coupons_item_right_select" v-if="order.bonus==item.bonus_id"></image>
|
|
<image src="../../static/img/select.png" mode="" class="coupons_item_right_select" v-else></image>
|
|
</view>
|
|
</view>
|
|
</view> -->
|
|
|
|
<view class="order_popup_pay">
|
|
<view class="pay_item" @click="selectPay(0)">
|
|
<image src="../../static/img/select1.png" mode="" class="pay_item_select" v-if="pay_index==0">
|
|
</image>
|
|
<image src="../../static/img/select2.png" mode="" class="pay_item_select" v-else></image>
|
|
<view class="pay_item_right">
|
|
<image src="../../static/img/pay_pal.png" mode=""></image>
|
|
<text>Pay Pal</text>
|
|
</view>
|
|
</view>
|
|
<view class="pay_item" @click="selectPay(1)">
|
|
<image src="../../static/img/select1.png" mode="" class="pay_item_select" v-if="pay_index==1">
|
|
</image>
|
|
<image src="../../static/img/select2.png" mode="" class="pay_item_select" v-else></image>
|
|
<view class="pay_item_right">
|
|
<image src="../../static/img/card.png" mode=""></image>
|
|
<text>Credit/Debit Card</text>
|
|
</view>
|
|
</view>
|
|
<!-- <view class="pay_item" @click="selectPay(2)">
|
|
<image src="../../static/img/select1.png" mode="" class="pay_item_select" v-if="pay_index==2"></image>
|
|
<image src="../../static/img/select2.png" mode="" class="pay_item_select" v-else></image>
|
|
<view class="pay_item_right">
|
|
<image src="../../static/img/GPay.png" mode=""></image>
|
|
<text>Google Pay</text>
|
|
</view>
|
|
</view>
|
|
<view class="pay_item" @click="selectPay(3)">
|
|
<image src="../../static/img/select1.png" mode="" class="pay_item_select" v-if="pay_index==3"></image>
|
|
<image src="../../static/img/select2.png" mode="" class="pay_item_select" v-else></image>
|
|
<view class="pay_item_right">
|
|
<image src="../../static/img/APay.png" mode=""></image>
|
|
<text>Apple pay</text>
|
|
</view>
|
|
</view> -->
|
|
<!-- <navigator url="/pages/order/paySuccess"> -->
|
|
<button @click="submitorder">PAY NOW</button>
|
|
<!-- </navigator> -->
|
|
</view>
|
|
|
|
<!-- <view class="order_popup_points" v-show="popup_index==3">
|
|
<view class="points_item">
|
|
<image src="../../static/img/select2.png" mode=""></image>
|
|
<text>Use points</text>
|
|
</view>
|
|
<view class="points_item">
|
|
<image src="../../static/img/select1.png" mode=""></image>
|
|
<text>Do not use points</text>
|
|
</view>
|
|
</view> -->
|
|
|
|
</view>
|
|
<view class="mask" @click="isCoupons=false,isPoints= false,popup_index=-1"
|
|
v-show="(isCoupons && list)||isPoints ||popup_index==0"></view>
|
|
<view class="coupons" v-show="isCoupons">
|
|
|
|
<view class="order_popup_title">
|
|
<text>Coupons</text>
|
|
<image src="../../static/img/close1.png" mode="" @click="isCoupons=false"></image>
|
|
</view>
|
|
|
|
<!-- <scroll-view scroll-y="true" style="min-height:400rpx;max-height:600rpx" > -->
|
|
<view class="margin_top">
|
|
<view class="coupons_item " v-for="(item,index) in list " :key="item.bonus_id">
|
|
<view class="coupons_item_left">
|
|
<view class="item_left_prcie">${{item.type_money}}</view>
|
|
<text class="item_left_span">Min.spend</text>
|
|
<view>${{item.min_goods_amount}}</view>
|
|
</view>
|
|
<view class="coupons_item_right">
|
|
<view class="coupons_right_info">
|
|
<view class="coupons_right_info_title">{{item.type_name}}</view>
|
|
<text>The tide zone is available</text>
|
|
<view class="coupons_right_info_time">{{item.use_start_date}} - {{item.use_end_date}}</view>
|
|
</view>
|
|
|
|
<view>
|
|
<view class="select_cop"
|
|
v-show="current!=index &&item.use==true&& (parseFloat(item.min_goods_amount) < totalnum ||parseFloat(item.min_goods_amount) ==totalnum) && bonus != item.type_money ">
|
|
<image src="../../static/icon/flase.png" @click="current=index,useCoupons(index,item)">
|
|
</image>
|
|
</view>
|
|
<view class="select_cop" v-show="current== index|| bonus == item.type_money">
|
|
<image src="../../static/icon/true.png"
|
|
@click="current=-1,bonus=0,total.bonus = 0,useCoupons(index,item)"></image>
|
|
</view>
|
|
<button @click="gotoindex()" v-if="item.use==false">Use Now</button>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<!-- </scroll-view> -->
|
|
</view>
|
|
<!-- point -->
|
|
<scroll-view class="coupons" v-show="isPoints" scroll-y="true">
|
|
<view class="order_popup_title">
|
|
<text>Points (total:</text><text style="color:darkred">{{ count}} </text>)
|
|
<image src="../../static/img/close1.png" mode="" @click="isPoints=false"></image>
|
|
</view>
|
|
<view class="order_popup_points">
|
|
<view class="points_item">
|
|
<image src="../../static/img/select2.png" mode="" v-if="!use"
|
|
@click="use=true,nouse=false,Thepoint()"></image>
|
|
<image src="../../static/img/select1.png" mode="" v-if="use"
|
|
@click="use=false,nouse=true,Thepoint()"></image>
|
|
<text>Use points</text>
|
|
</view>
|
|
<view class="points_item">
|
|
<image src="../../static/img/select2.png" mode="" v-if="!nouse "
|
|
@click="nouse=true,use=false,Thepoint()"></image>
|
|
<image src="../../static/img/select1.png" mode="" v-if="nouse"
|
|
@click="nouse=false,use=true,Thepoint()"></image>
|
|
<text>Do not use points</text>
|
|
</view>
|
|
</view>
|
|
</scroll-view>
|
|
|
|
<scroll-view class="coupons" v-show="popup_index == 0" scroll-y="true">
|
|
<view class="order_popup_title">
|
|
<text>Items</text>
|
|
<image src="../../static/img/close1.png" mode="" @click="popup_index=-1"></image>
|
|
</view>
|
|
<view class="good_info " v-for="(item,index) in goods_list " :key="index"
|
|
:class="index ==0?'padding-top':''">
|
|
<view class="good_info_left">
|
|
<view class="good_info_image img_border">
|
|
<image :src="item.goods_thumb" mode="" class="img_border"></image>
|
|
</view>
|
|
<view class="left_info">
|
|
<view class="info_name">{{item.goods_name}}</view>
|
|
<view class="left_info_bottom">
|
|
<view class="info_lable" v-if="item.goods_attr">
|
|
<text>{{item.goods_attr |goodsAttr}}</text>
|
|
|
|
</view>
|
|
<text>x{{item.goods_number}}</text>
|
|
</view>
|
|
<view class="info_price">US${{item.goods_price}}</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
</scroll-view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import {
|
|
defaultRequest2,
|
|
defaultRequest3
|
|
} from '../../api/index.js'
|
|
export default {
|
|
data() {
|
|
return {
|
|
isShow: false,
|
|
popup_index: -1,
|
|
isCoupons: false,
|
|
popup_good: -1,
|
|
isPoints: false,
|
|
isusebonus: 1,
|
|
query: {
|
|
_action: 'cartcheckout',
|
|
is_new: 1,
|
|
direct_shopping: 0,
|
|
consignee: ''
|
|
},
|
|
orderDate: {},
|
|
address: {},
|
|
goods_list: [],
|
|
shipping_list: [],
|
|
bonus_list: [],
|
|
bonus: 0,
|
|
total: {},
|
|
order: {
|
|
shipping_id: 11
|
|
},
|
|
// 支付方式: 0、支付宝 1、银行卡、信用卡 2、谷歌支付 4、苹果支付
|
|
pay_index: 0,
|
|
tag: 0,
|
|
orderId: 0,
|
|
list: [], //红包列表
|
|
current: -1,
|
|
count: 0,
|
|
Points: 0,
|
|
use: true,
|
|
nouse: false,
|
|
bouns_id: '',
|
|
totalnum: 0,
|
|
|
|
}
|
|
},
|
|
filters: {
|
|
fnum(a, b) {
|
|
let tag = false
|
|
if (parseFloat(a) < parseFloat(b) || parseFloat(a) == parseFloat(b)) {
|
|
tag = true
|
|
|
|
}
|
|
return tag;
|
|
|
|
}
|
|
},
|
|
methods: {
|
|
place() {
|
|
if (!this.address) {
|
|
uni.showToast({
|
|
icon: 'none',
|
|
title: 'please add address',
|
|
duration: 2000
|
|
})
|
|
this.isShow = false
|
|
} else if (this.total.amount != 0 && this.address) {
|
|
this.isShow = true
|
|
} else {
|
|
this.isShow = false
|
|
this.submitorder()
|
|
setTimeout(() => {
|
|
uni.showToast({
|
|
icon: 'none',
|
|
title: 'ok!',
|
|
duration: 2000
|
|
})
|
|
}, 1000)
|
|
uni.navigateTo({
|
|
url: '../account/myOrders?index=' + 0
|
|
});
|
|
|
|
|
|
}
|
|
},
|
|
// 使用红包
|
|
useCoupons(index, item) {
|
|
// this.current = -1
|
|
let total = uni.getStorageSync('total')
|
|
console.log(this.current + '=====================')
|
|
// this.bouns_id = item.bonus_id
|
|
console.log(total)
|
|
|
|
if (this.current == index) {
|
|
this.bonus = item.type_money
|
|
console.log(this.bonus)
|
|
console.log(item.type_money)
|
|
console.log(this.total.bonus)
|
|
this.total.bonus = item.type_money
|
|
console.log(this.total.bonus)
|
|
let id = item.bonus_id
|
|
this.bouns_id = item.bonus_id
|
|
let data = {
|
|
_action: 'cartselectbonus',
|
|
bonus: id,
|
|
consignee: this.address
|
|
}
|
|
////console.log(data)
|
|
// defaultRequest3(data,'consignee').then(res=>{
|
|
// if(res.error==0){
|
|
|
|
// this.total=res.data.total
|
|
// ////console.log(this.total.bonus)
|
|
// uni.setStorageSync('Total',this.total)
|
|
// this.order=res.data.order
|
|
|
|
// //使用了余额
|
|
// this.usemethod()
|
|
// // this.Thepoint()
|
|
|
|
// }
|
|
// })
|
|
this.total.amount = (parseFloat(total.amount) - parseFloat(this.Points)).toFixed(2)
|
|
// this.total.amount = (parseFloat(total.amount) - parseFloat(this.bonus)).toFixed(2) - (parseFloat(this.Points).toFixed(2))
|
|
console.log(this.total.amount)
|
|
|
|
} else {
|
|
this.bonus = 0
|
|
this.total = uni.getStorageSync('total')
|
|
// this.Thepoint()
|
|
}
|
|
// this.isCoupons = false
|
|
},
|
|
|
|
|
|
gotoindex() {
|
|
uni.switchTab({
|
|
url: '../index/index'
|
|
})
|
|
},
|
|
// 获取调用支付信息数据
|
|
getPayDate(id, will_get_integral) {
|
|
let data
|
|
//////console.log(222)
|
|
if (this.pay_index == 0) {
|
|
data = {
|
|
_action: 'payorder',
|
|
order_id: id,
|
|
order_type: 'GOODSBUY',
|
|
payment_method: 'paypal'
|
|
}
|
|
defaultRequest2(data).then(res => {
|
|
console.info(data,'支付')
|
|
console.log(res)
|
|
if (res.error == 0) {
|
|
console.log(res.error);
|
|
// plus.runtime.openURL(res.data.prepay_data.checkoutnow_url)
|
|
// this.src = res.data.prepay_data.checkoutnow_url
|
|
uni.navigateTo({
|
|
url: './paypalWebview?src=' + res.data.prepay_data.checkoutnow_url
|
|
})
|
|
}
|
|
})
|
|
} else if (this.pay_index == 1) {
|
|
// 银行卡支付
|
|
data = {
|
|
_action: 'payorder',
|
|
order_id: id,
|
|
order_type: 'GOODSBUY',
|
|
payment_method: 'oceanpay'
|
|
}
|
|
defaultRequest2(data).then(res => {
|
|
console.info(data,'支付1111')
|
|
console.log(res)
|
|
|
|
console.log(res.error);
|
|
if (res.error == 0) {
|
|
// plus.runtime.openURL(res.data.prepay_data.checkoutnow_url)
|
|
// this.src = res.data.prepay_data.checkoutnow_url
|
|
uni.navigateTo({
|
|
url: './paypalWebview?src=' + res.data.prepay_data.checkoutnow_url
|
|
})
|
|
}
|
|
})
|
|
} else {
|
|
data = {
|
|
_action: 'payorder',
|
|
order_id: id,
|
|
order_type: 'GOODSBUY',
|
|
payment_method: 'alipay.native'
|
|
}
|
|
defaultRequest2(data).then(res => {
|
|
//////console.info(res,'支付宝')
|
|
if (res.error == 0) {
|
|
//订单对象,从服务器获取
|
|
uni.requestPayment({
|
|
provider: 'alipay',
|
|
orderInfo: res.data.prepay_data.order_info, //支付宝订单数据
|
|
success: function(res) {
|
|
////////console.log('success:' + JSON.stringify(res));
|
|
uni.redirectTo({
|
|
url: 'paySuccess?type=0&order_id=' + id +
|
|
'&will_get_integral=' + will_get_integral
|
|
});
|
|
},
|
|
fail: function(err) {
|
|
////////console.log('fail:' + JSON.stringify(err));
|
|
uni.redirectTo({
|
|
url: 'paySuccess?type=1&order_id=' + id +
|
|
'&will_get_integral=' + will_get_integral
|
|
});
|
|
}
|
|
});
|
|
}
|
|
})
|
|
}
|
|
|
|
|
|
},
|
|
Thepoint() {
|
|
//使用余额 使用红包
|
|
if (this.use && (this.current != -1 || this.bonus != 0)) {
|
|
this.total.bonus = this.bonus
|
|
this.total = uni.getStorageSync('total')
|
|
// 余额大于商品总额
|
|
if (parseFloat(this.count) > this.total.amount) {
|
|
let i = (parseFloat(this.count) - this.total.amount - parseFloat(this.total.bonus)).toFixed(2)
|
|
// this.Points = (this.total.amount - parseFloat(this.total.bonus)).toFixed(2)
|
|
this.Points = this.total.amount - this.bonus
|
|
|
|
this.total.amount = 0
|
|
} else if (parseFloat(this.count) < this.total.amount) {
|
|
let i = (this.total.amount - parseFloat(this.count)).toFixed(2)
|
|
|
|
this.Points = this.count
|
|
this.total.amount = (this.total.amount - parseFloat(this.Points)).toFixed(2)
|
|
}
|
|
}
|
|
//使用红包
|
|
else if (!this.use && this.current !== -1) {
|
|
this.Points = 0
|
|
this.total = uni.getStorageSync('Total')
|
|
}
|
|
// 都不使用
|
|
else if (!this.use && this.current == -1) {
|
|
this.Points = 0
|
|
this.bonus = 0
|
|
this.total = uni.getStorageSync('total')
|
|
}
|
|
//使用余额
|
|
else {
|
|
if (parseFloat(this.count) > this.total.amount) {
|
|
let i = (parseFloat(this.count) - this.total.amount - parseFloat(this.total.bonus)).toFixed(2)
|
|
// this.Points = (this.total.amount - parseFloat(this.total.bonus)).toFixed(2)
|
|
this.Points = this.total.amount
|
|
//////console.log(this.Points)
|
|
this.total.amount = 0
|
|
|
|
} else if (parseFloat(this.count) < this.total.amount) {
|
|
let i = (this.total.amount - parseFloat(this.count)).toFixed(2)
|
|
// this.total.amount = i
|
|
this.Points = this.count
|
|
this.total.amount = (this.total.amount - parseFloat(this.Points)).toFixed(2)
|
|
}
|
|
}
|
|
this.isPoints = false
|
|
},
|
|
// 选择支付方式
|
|
selectPay(index) {
|
|
this.pay_index = index
|
|
},
|
|
goAddress() {
|
|
uni.navigateTo({
|
|
url: '../account/address?type=1'
|
|
})
|
|
},
|
|
|
|
// 提交订单
|
|
submitorder() {
|
|
let data = {
|
|
_action: 'submitorder',
|
|
consignee: this.address,
|
|
postscript: '',
|
|
bonus: this.bouns_id,
|
|
surplus: this.Points,
|
|
// surplus:this.order.surplus,
|
|
// shipping_id:this.orderId,
|
|
shipping_id: this.order.shipping_id,
|
|
directshopping: 0,
|
|
}
|
|
defaultRequest3(data, 'consignee').then(res => {
|
|
//////console.info(res)
|
|
//////console.log(data)
|
|
if (res.error == 0) {
|
|
this.getPayDate(res.data.order.order_id, res.data.will_get_integral)
|
|
}
|
|
})
|
|
},
|
|
|
|
// 变更配送方式
|
|
cartselectshipping(id) {
|
|
// let data={_action:'cartselectshipping',shipping_id:id,consignee:this.address}
|
|
let data = {
|
|
_action: 'cartselectshipping',
|
|
shipping_id: id,
|
|
consignee: {
|
|
country: '4191'
|
|
}
|
|
}
|
|
defaultRequest3(data, 'consignee').then(res => {
|
|
console.log(data)
|
|
console.info(res)
|
|
if (res.error == 0) {
|
|
this.tag = 1
|
|
this.total = res.data.total
|
|
//console.log(this.total)
|
|
this.totalnum = this.total.amount
|
|
// console.log(typeof(this.totalnum))
|
|
uni.setStorageSync('total', (res.data.total))
|
|
this.order = res.data.order
|
|
// console.log(res.data)
|
|
this.orderId = res.data.order.shipping_id
|
|
// this.usemethod()
|
|
this.Thepoint()
|
|
}
|
|
})
|
|
},
|
|
getList(query, e) {
|
|
defaultRequest3(query, 'consignee').then(res => {
|
|
console.log(query)
|
|
console.info(res)
|
|
if (res.error == 0) {
|
|
this.orderDate = res.data
|
|
if (e == 1) {
|
|
this.address = res.data.consignee
|
|
}
|
|
this.goods_list = res.data.goods_list
|
|
this.total = res.data.total
|
|
|
|
if (e == 2) {
|
|
this.shipping_list = res.data.shipping_list
|
|
console.info(res.data.shipping_list + "=======================")
|
|
this.orderId = this.shipping_list[0].shipping_id
|
|
}
|
|
|
|
//console.info(res.data)
|
|
////console.log(this.shipping_list[0].shipping_id)
|
|
this.cartselectshipping(this.orderId)
|
|
if (res.data.bonus_list) {
|
|
this.bonus_list = res.data.bonus_list
|
|
}
|
|
this.order = res.data.order
|
|
}
|
|
})
|
|
// 获取红包
|
|
let data = {
|
|
_action: 'getuserbonus'
|
|
}
|
|
var time = new Date();
|
|
|
|
var today = time.toLocaleString()
|
|
console.log(time.toLocaleString())
|
|
defaultRequest2(data).then(res => {
|
|
////////console.info(res)
|
|
if (res.error == 0) {
|
|
this.list = res.data
|
|
console.log(this.list + '===========sasass');
|
|
////console.log(this.list[0].type_money)
|
|
// this.bonus = this.list[0].type_money
|
|
// console.log(this.total.amount)
|
|
let list = []
|
|
let list2 = []
|
|
res.data.map(item => {
|
|
let hb_time = new Date(Date.parse(item.use_end_date))
|
|
// console.log(new Date(Date.parse(item.use_end_date)))
|
|
item.use = hb_time > new Date(Date.parse(today))
|
|
// this.list = []
|
|
list.push(item)
|
|
this.list = list
|
|
if (parseFloat(item.min_goods_amount) < this.totalnum) {
|
|
list2.push(item)
|
|
}
|
|
// console.log(hb_time > new Date(Date.parse(today)))
|
|
})
|
|
|
|
if (list2.length > 0) {
|
|
let max = 0
|
|
for (let i = 0; i < list2.length; i++) {
|
|
if (max < list2[i].type_money) {
|
|
max = list2[i].type_money
|
|
}
|
|
}
|
|
this.bonus = max
|
|
this.isusebonus = 1
|
|
} else if (list2.length == 0) {
|
|
this.isusebonus = 0
|
|
|
|
}
|
|
|
|
this.bonus_id = list2[0].bonus_id
|
|
let sum = (parseFloat(this.total.amount) - parseFloat(this.bonus).toFixed(2)).toFixed(2)
|
|
console.log(sum)
|
|
if (sum > 0 || sum == 0) {
|
|
this.total.amount = sum
|
|
}
|
|
|
|
// uni.setStorageSync('Total',this.total)
|
|
// uni.setStorageSync('totalsum',sum)
|
|
|
|
console.log(this.list)
|
|
// this.current = this.list.length
|
|
}
|
|
})
|
|
//获取余额
|
|
defaultRequest2({
|
|
_action: 'getusersummarydata'
|
|
}).then(res => {
|
|
////////console.log(res)
|
|
if (res.error == 0) {
|
|
this.count = res.data.user_info.user_money
|
|
// this.count = 4.00
|
|
|
|
}
|
|
})
|
|
},
|
|
openMore(i) {
|
|
this.popup_index = i
|
|
//console.log(this.popup_index)
|
|
if (i == 1) {
|
|
|
|
if (!this.list) {
|
|
uni.showToast({
|
|
icon: 'none',
|
|
title: 'No coupon available',
|
|
duration: 2000
|
|
})
|
|
return
|
|
} else {
|
|
this.isCoupons = true
|
|
}
|
|
if (this.orderDate.allow_use_bonus == 0) {
|
|
uni.showToast({
|
|
icon: 'none',
|
|
title: 'Coupon cannot be used for this product',
|
|
duration: 2000
|
|
})
|
|
return
|
|
}
|
|
}
|
|
if (i == 3) {
|
|
if (this.count > 0) {
|
|
this.isPoints = true
|
|
} else {
|
|
uni.showToast({
|
|
icon: 'none',
|
|
title: 'Points cannot be used for this product',
|
|
duration: 2000
|
|
})
|
|
}
|
|
// if(this.orderDate.allow_use_integral==0){
|
|
// uni.showToast({
|
|
// icon:'none',
|
|
// title:'Points cannot be used for this product'
|
|
// })
|
|
// return
|
|
// }
|
|
} else {
|
|
if (!this.address) {
|
|
uni.showToast({
|
|
icon: 'none',
|
|
title: 'please add address',
|
|
duration: 2000
|
|
})
|
|
} else if (!this.orderId || this.tag == 0) {
|
|
uni.showToast({
|
|
icon: 'none',
|
|
title: 'please select shipping method',
|
|
duration: 2000
|
|
})
|
|
}
|
|
// else{
|
|
// this.isShow=true
|
|
// }
|
|
}
|
|
|
|
}
|
|
},
|
|
onLoad(e) {
|
|
let that = this;
|
|
let s = 0;
|
|
let time = setInterval(() => {
|
|
uni.getNetworkType({
|
|
success: (res) => {
|
|
console.log(res.networkType, s);
|
|
if (res.networkType == 'none') {
|
|
uni.showToast({
|
|
icon: 'none',
|
|
title: 'Please connect to the network',
|
|
duration: 3000,
|
|
})
|
|
} else if (res.networkType !== 'none') {
|
|
that.typee = 2;
|
|
clearInterval(time);
|
|
|
|
}
|
|
}
|
|
})
|
|
s++;
|
|
}, 1000);
|
|
// this.current = this.list.length
|
|
this.query = JSON.parse(e.query)
|
|
console.log(this.query)
|
|
this.getList(this.query, 1)
|
|
let query2 = {
|
|
_action: 'cartcheckout',
|
|
is_new: 1,
|
|
direct_shopping: 0,
|
|
consignee: {
|
|
country: '4191'
|
|
}
|
|
}
|
|
this.cartselectshipping(11)
|
|
this.getList(query2, 2)
|
|
// if(e.orderId){
|
|
// this.orderId = e.orderId
|
|
// this.order.shipping_id = e.orderId
|
|
// }
|
|
this.orderId = 11
|
|
this.order.shipping_id = 11
|
|
// this.bonus = item.type_money
|
|
// this.cartselectshipping(this.orderId)
|
|
if (this.orderId) {
|
|
this.tag = 1
|
|
}
|
|
////console.log(e.orderId)
|
|
|
|
// this.getList(query2)
|
|
|
|
},
|
|
onShow(e) {
|
|
// this.query=JSON.parse(e.query)
|
|
console.log(e)
|
|
this.getList(this.query, 1)
|
|
// this.getList(this.query,1)
|
|
|
|
uni.$once('query', (query) => {
|
|
////////console.info(query)
|
|
if (query.type == 'address') {
|
|
this.query.consignee = query.consignee
|
|
this.query.is_new = 0
|
|
////////console.log(this.query)
|
|
this.getList(this.query, 1)
|
|
}
|
|
});
|
|
},
|
|
filters: {
|
|
goodsAttr(e) {
|
|
return e.replace(/\s\n/g, ';');
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
<style>
|
|
page {
|
|
border-top: 14.67rpx #F6F5FA solid;
|
|
padding-bottom: 140rpx;
|
|
}
|
|
</style>
|
|
<style lang="scss" scoped>
|
|
@import "@/common/scss/order.scss";
|
|
|
|
|
|
|
|
.order_info {
|
|
padding-left: 26.67rpx;
|
|
padding-right: 22.67rpx;
|
|
padding-top: 50.67rpx;
|
|
padding-bottom: 42.67rpx;
|
|
border-bottom: 14.67rpx #F6F5FA solid;
|
|
|
|
.info_title {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
font-weight: bold;
|
|
font-size: 26.67rpx;
|
|
|
|
.info_title_right {
|
|
display: flex;
|
|
align-items: center;
|
|
color: #666666;
|
|
font-size: 24rpx;
|
|
|
|
image {
|
|
margin-left: 33.33rpx;
|
|
}
|
|
}
|
|
}
|
|
|
|
.info_image {
|
|
display: flex;
|
|
margin-top: 26.67rpx;
|
|
|
|
.info_image_item {
|
|
width: 133.33rpx;
|
|
height: 133.33rpx;
|
|
margin-right: 12rpx;
|
|
background-color: #999999;
|
|
}
|
|
}
|
|
}
|
|
|
|
.method {
|
|
border-bottom: 14.67rpx #F6F5FA solid;
|
|
padding-top: 50rpx;
|
|
|
|
.method_title {
|
|
font-size: 26.67rpx;
|
|
font-weight: bold;
|
|
padding-left: 25.33rpx;
|
|
}
|
|
|
|
.method_item {
|
|
padding: 41.33rpx 0;
|
|
border-bottom: 1px #E2E2E2 solid;
|
|
padding-left: 42.67rpx;
|
|
padding-right: 29.33rpx;
|
|
display: flex;
|
|
align-items: center;
|
|
|
|
&:last-child {
|
|
border-bottom: none;
|
|
}
|
|
|
|
.method_item_image {
|
|
width: 30rpx;
|
|
height: 30rpx;
|
|
|
|
image {
|
|
width: 100%;
|
|
height: 100%;
|
|
}
|
|
}
|
|
|
|
.method_item_right {
|
|
margin-left: 30.67rpx;
|
|
|
|
.item_price {
|
|
font-size: 28rpx;
|
|
margin-bottom: 14rpx;
|
|
|
|
.item_price_span {
|
|
color: #B22234;
|
|
}
|
|
}
|
|
|
|
.item_time {
|
|
font-size: 25.33rpx;
|
|
font-weight: 400;
|
|
|
|
.item_time_span {
|
|
color: #555555;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
.discount {
|
|
border-bottom: 14.67rpx #F6F5FA solid;
|
|
padding-left: 26rpx;
|
|
padding-right: 22.67rpx;
|
|
padding-top: 42rpx;
|
|
padding-bottom: 45.33rpx;
|
|
|
|
.discount_item {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
font-size: 28rpx;
|
|
margin-bottom: 42rpx;
|
|
|
|
&:last-child {
|
|
margin-bottom: 0;
|
|
}
|
|
|
|
.discount_item_left {
|
|
.discount_item_left_span {
|
|
color: #666666;
|
|
}
|
|
}
|
|
|
|
.discount_item_right {
|
|
display: flex;
|
|
align-items: center;
|
|
color: #B22234;
|
|
font-weight: bold;
|
|
|
|
image {
|
|
margin-left: 14rpx;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
.settlement {
|
|
border-bottom: 14.67rpx #F6F5FA solid;
|
|
padding: 44rpx 26rpx;
|
|
|
|
.settlement_item {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
font-size: 28rpx;
|
|
margin-bottom: 44rpx;
|
|
|
|
&:last-child {
|
|
margin-bottom: 0;
|
|
}
|
|
|
|
.settlement_item_right {
|
|
color: #3C3B6E;
|
|
font-weight: bold;
|
|
}
|
|
|
|
.settlement_item_right1 {
|
|
color: #B22234;
|
|
font-weight: bold;
|
|
}
|
|
}
|
|
}
|
|
|
|
.total {
|
|
padding: 30.67rpx 0;
|
|
padding-left: 26rpx;
|
|
padding-right: 19.33rpx;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
width: 100%;
|
|
position: fixed;
|
|
bottom: 0;
|
|
left: 0;
|
|
background-color: white;
|
|
z-index: 99;
|
|
box-sizing: border-box;
|
|
font-size: 36rpx;
|
|
font-weight: 600;
|
|
|
|
button {
|
|
font-size: 26.67rpx;
|
|
color: white;
|
|
height: 73.33rpx;
|
|
line-height: 73.33rpx;
|
|
border-radius: 0;
|
|
border: none;
|
|
background-color: black;
|
|
margin: 0;
|
|
}
|
|
}
|
|
|
|
// 红包
|
|
.coupons {
|
|
z-index: 999;
|
|
position: fixed;
|
|
bottom: 0;
|
|
left: 0;
|
|
max-height: 50vh;
|
|
overflow-y: scroll;
|
|
background-color: white;
|
|
padding-left: 29.33rpx;
|
|
padding-right: 29.33rpx;
|
|
box-sizing: border-box;
|
|
// padding-top: 20.67rpx;
|
|
width: 100%;
|
|
font-size: 30.67rpx;
|
|
font-weight: 400;
|
|
padding-bottom: 17.67rpx;
|
|
|
|
.margin_top {
|
|
margin-top: 80rpx;
|
|
}
|
|
|
|
.order_popup_title {
|
|
position: fixed;
|
|
width: 100%;
|
|
z-index: 999;
|
|
line-height: 50rpx;
|
|
margin-bottom: 100rpx;
|
|
text-align: center;
|
|
background-color: #fff;
|
|
font-size: 32rpx;
|
|
font-weight: bold;
|
|
// border-bottom: 1px solid #E2E2E2;
|
|
display: flex;
|
|
color: #000;
|
|
padding-top: 14rpx;
|
|
align-items: center;
|
|
justify-content: center;
|
|
// padding-top: 44.67rpx;
|
|
padding-bottom: 20.67rpx;
|
|
text-align: center;
|
|
|
|
image {
|
|
width: 21.33rpx;
|
|
height: 21.33rpx;
|
|
padding-right: 30rpx;
|
|
// position: absolute;
|
|
// right: 26rpx;
|
|
|
|
}
|
|
}
|
|
|
|
.select_cop {
|
|
height: 50rpx;
|
|
width: 50rpx;
|
|
margin: 0rpx 0rpx 15rpx 80rpx;
|
|
|
|
image {
|
|
height: 100%;
|
|
width: 100%;
|
|
}
|
|
}
|
|
|
|
.order_popup_points {
|
|
|
|
padding-bottom: 40rpx;
|
|
padding-left: 47.33rpx;
|
|
padding-top: 47rpx;
|
|
font-size: 28rpx;
|
|
text-align: center;
|
|
|
|
.points_item {
|
|
display: flex;
|
|
align-items: center;
|
|
margin-bottom: 40rpx;
|
|
|
|
&:last-child {
|
|
margin-bottom: 0;
|
|
}
|
|
|
|
&:first-child {
|
|
margin-top: 60rpx;
|
|
}
|
|
|
|
image {
|
|
width: 29.33rpx;
|
|
height: 29.33rpx;
|
|
margin-right: 26rpx;
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</style>
|
|
|