@ -19,10 +19,10 @@
< image src = "../../static/img/address_xian.png" class = "address_xian" mode = "" > < / image >
< / view >
< view class = "order_info" @click ="openMore(0)" >
< view class = "order_info" @ click = "popup_good=true, openMore(0)" >
< view class = "info_title" >
< text > Items in cart < / text >
< view class = "info_title_right" >
< 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 >
@ -35,7 +35,7 @@
< view class = "method" >
< view class = "method_title" > Shipping Method < / view >
< view class = "method_item" v-for ="(item,index) in shipping_list " :key ="index ">
< 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 >
@ -91,42 +91,24 @@
< view class = "total" >
< text > Total : US$ { { total . amount } } < / text >
< button @click ="openMore(2 )" > PLACE ORDER < / button >
< 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 >
<!-- < 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_commodity" v-show ="popup_index==0" >
< view class = "good_info" v-for ="(item,index) in goods_list " :key ="index" >
< view class = "good_info_left " >
< view class = "good_info_image" >
< image :src ="item.goods_thumb" mode = "" > < / 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 >
<!-- < image src = "/static/img/bottom.png" mode = "" > < / image > -- >
< / view >
< text > x { { item . goods_number } } < / text >
< / view >
< view class = "info_price" > US$ { { item . goods_price } } < / view >
< / view >
< / view >
< / view >
< / view >
< view class = "order_popup_coupons" v-show ="popup_index==1" >
<!-- < 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 >
@ -144,9 +126,9 @@
< image src = "../../static/img/select.png" mode = "" class = "coupons_item_right_select" v-else > < / image >
< / view >
< / view >
< / view >
< / view > -- >
< view class = "order_popup_pay" v-show ="popup_index==2" >
< 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 >
@ -155,7 +137,7 @@
< text > Pay Pal < / text >
< / view >
< / view >
< view class = "pay_item" @click ="selectPay(1)" >
<!-- < 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" >
@ -178,7 +160,7 @@
< image src = "../../static/img/APay.png" mode = "" > < / image >
< text > Apple pay < / text >
< / view >
< / view >
< / view > -- >
<!-- < navigator url = "/pages/order/paySuccess" > -- >
< button @click ="submitorder" > PAY NOW < / button >
<!-- < / navigator > -- >
@ -196,13 +178,14 @@
< / view > -- >
< / view >
< view class = "mask" @ click = "isCoupons=false,isPoints= false" v-show ="(isCoupons && list)||isPoints" > < / view >
< view class = "coupons" v-show ="isCoupons &&list " >
< 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 >
< view class = "coupons_item" v-for ="(item,index) in list " :key="item.bonus_id" >
<!-- < scroll -view scroll -y = " true " style = "min-height:400rpx;max-height:600rpx" > -- >
< 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 >
@ -216,36 +199,63 @@
< / view >
< view >
< view class = "select_cop" v-show ="current!=index&&parseFloat(item.min_goods_amount) <totalnum ||parseFloat(item.min_goods_amount) ==totalnum " >
< 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 " >
< 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()" > Use Now < / button >
< button @click ="gotoindex()" v-if ="item.use==true" > Use Now < / button >
< / view >
< / view >
< / view >
<!-- < / s c r o l l - v i e w > - - >
< / view >
<!-- point -- >
< view class = "coupons" v-show ="isPoints" >
< 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 > )
< 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" @click ="Thepoint()" >
< view class = "order_popup_points" >
< view class = "points_item" >
< image src = "../../static/img/select2.png" mode = "" v-if ="!use" @click="use=true,nouse=false" > < / image >
< image src = "../../static/img/select1.png" mode = "" v-if ="use" @click="use=false,nouse=true" > < / image >
< 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" @click ="Thepoint()" >
< image src = "../../static/img/select2.png" mode = "" v-if ="!nouse " @click="nouse=true,use=false" > < / image >
< image src = "../../static/img/select1.png" mode = "" v-if ="nouse" @click="nouse=false,use=true" > < / image >
< 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 >
< / view >
< / s c r o l l - v i e w >
< 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" >
< view class = "good_info_left " >
< view class = "good_info_image" >
< image :src ="item.goods_thumb" mode = "" > < / 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 >
< / s c r o l l - v i e w >
< / view >
< / template >
@ -255,8 +265,9 @@
data ( ) {
return {
isShow : false ,
popup_index : '' ,
popup_index : - 1 ,
isCoupons : false ,
popup_good : - 1 ,
isPoints : false ,
query : {
_action : 'cartcheckout' ,
@ -282,8 +293,8 @@
current : - 1 ,
count : 0 ,
Points : 0 ,
use : fals e,
nouse : tru e,
use : tru e,
nouse : fals e,
bouns_id : '' ,
totalnum : 0 ,
@ -302,73 +313,73 @@
}
} ,
methods : {
place ( ) {
if ( ! this . address ) {
uni . showToast ( {
icon : 'none' ,
title : 'please add address'
} )
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!'
} )
} , 1000 )
uni . navigateTo ( {
url : '../account/myOrders?index=' + 0
} ) ;
}
} ,
/ / 使 用 红 包
useCoupons ( index , item ) {
/ / t h i s . c u r r e n t = i n d e x
let total = this . total
console . log ( this . current )
let total = uni . getStorageSync ( 'total' )
/ / / / c o n s o l e . l o g ( t h i s . c u r r e n t )
/ / t h i s . b o u n s _ i d = i t e m . b o n u s _ i d
/ / c o n s o l e . l o g ( t o t a l )
/ / / / / / c o n s o l e . l o g ( t o t a l )
if ( this . current == index ) {
this . bonus = item . type_money
/ / c o n s o l e . l o g ( t h i s . b o n u s )
/ / / / / / c o n s o l e . l o g ( t h i s . b o n u s )
this . total . bonus = item . type_money
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
console . log ( this . use )
/ / 使 用 了 余 额
/ / c o n s o l e . l o g ( t h i s . c o u n t , t h i s . t o t a l . a m o u n t , t h i s . P o i n t s )
if ( this . use ) {
console . log ( this . count > this . total . amount )
if ( this . count > this . total . amount ) {
this . Points = this . total . amount
this . total . amount = 0
} else if ( this . count < this . total . amount || this . count == this . total . amount ) {
this . Points = this . count
let a = ( parseFloat ( this . Points ) + parseFloat ( this . total . bonus ) ) . toFixed ( 2 )
console . log ( this . total . amount )
this . total = uni . getStorageSync ( 'total' )
let b = ( this . total . amount - a ) . toFixed ( 2 )
console . log ( b )
this . total . amount = b
}
}
/ / / / c o n s o l e . l o g ( d a t a )
/ / d e f a u l t R e q u e s t 3 ( d a t a , ' c o n s i g n e e ' ) . t h e n ( r e s = > {
/ / i f ( r e s . e r r o r = = 0 ) {
/ / 不 使 用
else {
this . Points = 0
/ / c o n s o l e . l o g ( 2 2 2 )
}
/ / t h i s . t o t a l = r e s . d a t a . t o t a l
/ / / / / / c o n s o l e . l o g ( t h i s . t o t a l . b o n u s )
/ / u n i . s e t S t o r a g e S y n c ( ' T o t a l ' , t h i s . t o t a l )
/ / t h i s . o r d e r = r e s . d a t a . o r d e r
/ / / / / / c o n s o l e . l o g ( t h i s . u s e )
/ / / / 使 用 了 余 额
/ / t h i s . u s e m e t h o d ( )
/ / / / t h i s . T h e p o i n t ( )
}
} )
/ / }
/ / } )
this . total . amount = ( parseFloat ( total . amount ) - parseFloat ( this . bonus ) ) . toFixed ( 2 )
uni . setStorageSync ( 'Total' , this . total )
this . Thepoint ( )
}
else {
this . bonus = 0
this . total = uni . getStorageSync ( 'total' )
this . bouns_id = 0
/ / t h i s . P o i n t s = t h i s . t o t a l . a m o u n t
/ / c o n s o l e . l o g ( t h i s . t o t a l )
this . total = uni . getStorageSync ( 'total' )
this . Thepoint ( )
}
/ / t h i s . i s C o u p o n s = f a l s e
} ,
gotoindex ( ) {
uni . switchTab ( {
@ -378,67 +389,39 @@
/ / 获 取 调 用 支 付 信 息 数 据
getPayDate ( id , will_get_integral ) {
let data
/ / c o n s o l e . l o g ( 2 2 2 )
/ / / / / / c o n s o l e . l o g ( 2 2 2 )
if ( this . pay_index == 0 ) {
data = { _action : 'payorder' , order_id : id , order_type : 'GOODSBUY' , payment_method : 'paypal' }
defaultRequest2 ( data ) . then ( res => {
/ / / / c o n s o l e . i n f o ( d a t a , ' 支 付 ' )
/ / c o n s o l e . l o g ( r e s )
/ / / / / / / / c o n s o l e . i n f o ( d a t a , ' 支 付 ' )
/ / / / / / c o n s o l e . l o g ( r e s )
if ( res . error == 0 ) {
if ( res . data . need_pay_amount == 0 )
this . isShow = false
{
setTimeout ( ( ) => {
uni . showToast ( {
icon : 'none' ,
title : 'ok!'
/ / p l u s . r u n t i m e . o p e n U R L ( r e s . d a t a . p r e p a y _ d a t a . c h e c k o u t n o w _ u r l )
/ / t h i s . s r c = r e s . d a t a . p r e p a y _ d a t a . c h e c k o u t n o w _ u r l
uni . navigateTo ( {
url : './paypalWebview?src=' + res . data . prepay_data . checkoutnow_url
} )
} , 2000 )
uni . navigateTo ( {
url : '../account/myOrders'
} )
}
/ / p l u s . r u n t i m e . o p e n U R L ( r e s . d a t a . p r e p a y _ d a t a . c h e c k o u t n o w _ u r l )
/ / t h i s . s r c = r e s . d a t a . p r e p a y _ d a t a . c h e c k o u t n o w _ u r l
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 => {
/ / c o n s o l e . i n f o ( r e s , ' 支 付 宝 ' )
/ / / / / / c o n s o l e . i n f o ( r e s , ' 支 付 宝 ' )
if ( res . error == 0 ) {
/ / 订 单 对 象 , 从 服 务 器 获 取
if ( res . data . need_pay_amount == 0 ) {
if ( res . data . need_pay_amount == 0 )
this . isShow = false
{
setTimeout ( ( ) => {
uni . showToast ( {
icon : 'none' ,
title : 'ok!'
} )
} , 2000 )
uni . navigateTo ( {
url : '../account/myOrders'
} )
}
}
uni . requestPayment ( {
provider : 'alipay' ,
orderInfo : res . data . prepay_data . order_info , / / 支 付 宝 订 单 数 据
success : function ( res ) {
/ / / / c o n s o l e . l o g ( ' s u c c e s s : ' + J S O N . s t r i n g i f y ( r e s ) ) ;
/ / / / / / / / c o n s o l e . l o g ( ' s u c c e s s : ' + J S O N . s t r i n g i f y ( r e s ) ) ;
uni . redirectTo ( {
url : 'paySuccess?type=0&order_id=' + id + '&will_get_integral=' + will_get_integral
} ) ;
} ,
fail : function ( err ) {
/ / / / c o n s o l e . l o g ( ' f a i l : ' + J S O N . s t r i n g i f y ( e r r ) ) ;
/ / / / / / / / c o n s o l e . l o g ( ' f a i l : ' + J S O N . s t r i n g i f y ( e r r ) ) ;
uni . redirectTo ( {
url : 'paySuccess?type=1&order_id=' + id + '&will_get_integral=' + will_get_integral
} ) ;
@ -452,14 +435,18 @@
} ,
Thepoint ( ) {
/ / 使 用 余 额 使 用 红 包
/ / / / c o n s o l e . l o g ( t h i s . t o t a l )
if ( this . use && this . current != - 1 ) {
/ / / / / / / / c o n s o l e . l o g ( t h i s . t o t a l )
/ / i f ( t h i s . b o n u s ! = 0 ) {
/ / }
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 )
/ / t h i s . P o i n t s = ( t h i s . t o t a l . a m o u n t - p a r s e F l o a t ( t h i s . t o t a l . b o n u s ) ) . t o F i x e d ( 2 )
this . Points = this . total . amount
/ / c o n s o l e . l o g ( t h i s . P o i n t s )
/ / / / / / c o n s o l e . l o g ( t h i s . P o i n t s )
this . total . amount = 0
}
@ -467,16 +454,17 @@
let i = ( this . total . amount - parseFloat ( this . count ) ) . toFixed ( 2 )
/ / t h i s . t o t a l . a m o u n t = i
this . Points = this . count
this . total . amount = ( this . total . amount - parseFloat ( this . Points ) ) . toFixed ( 2 )
this . total . amount = ( this . total . amount - parseFloat ( this . Points ) ) . toFixed ( 2 )
}
}
/ / 使 用 红 包
else if ( ! this . use && this . current != - 1 ) {
else if ( ! this . use && this . current !== - 1 ) {
this . Points = 0
this . total = uni . getStorageSync ( 'Total' )
}
/ / 都 不 使 用
else if ( ! this . use && this . current == - 1 ) {
this . bonus = 0
this . total = uni . getStorageSync ( 'total' )
}
/ / 使 用 余 额
@ -485,7 +473,7 @@
let i = ( parseFloat ( this . count ) - this . total . amount - parseFloat ( this . total . bonus ) ) . toFixed ( 2 )
/ / t h i s . P o i n t s = ( t h i s . t o t a l . a m o u n t - p a r s e F l o a t ( t h i s . t o t a l . b o n u s ) ) . t o F i x e d ( 2 )
this . Points = this . total . amount
/ / c o n s o l e . l o g ( t h i s . P o i n t s )
/ / / / / / c o n s o l e . l o g ( t h i s . P o i n t s )
this . total . amount = 0
}
@ -496,7 +484,7 @@
this . total . amount = ( this . total . amount - parseFloat ( this . Points ) ) . toFixed ( 2 )
}
}
this . isPoints = false
} ,
/ / 选 择 支 付 方 式
selectPay ( index ) {
@ -522,60 +510,117 @@
directshopping : 0 ,
}
defaultRequest3 ( data , 'consignee' ) . then ( res => {
/ / c o n s o l e . i n f o ( r e s )
/ / c o n s o l e . l o g ( d a t a )
/ / / / / / c o n s o l e . i n f o ( r e s )
/ / / / / / c o n s o l e . l o g ( d a t a )
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 }
defaultRequest3 ( data , 'consignee' ) . then ( res => {
/ / / / c o n s o l e . i n f o ( r e s )
/ / / / c o n s o l e . i n f o ( d a t a )
if ( res . error == 0 ) {
this . tag = 1
this . total = res . data . total
/ / c o n s o l e . l o g ( t h i s . t o t a l )
this . totalnum = this . total . amount
console . log ( typeof ( this . totalnum ) )
uni . setStorageSync ( 'total' , ( res . data . total ) )
let ss = uni . getStorageSync ( 'total' )
this . order = res . data . order
this . orderId = res . data . order . shipping_id
/ / t h i s . u s e m e t h o d ( )
this . Thepoint ( )
}
} )
} ,
getList ( ) {
defaultRequest3 ( this . query , 'consignee' ) . then ( res => {
/ / / / c o n s o l e . l o g ( t h i s . q u e r y )
/ / / / c o n s o l e . i n f o ( r e s )
/ / / / / / / / c o n s o l e . l o g ( t h i s . q u e r y )
/ / c o n s o l e . i n f o ( r e s )
if ( res . error == 0 ) {
this . orderDate = res . data
this . address = res . data . consignee
this . goods_list = res . data . goods_list
this . total = res . data . total
/ / c o n s o l e . i n f o ( t h i s . g o o d s _ l i s t )
this . shipping_list = res . data . shipping_list
/ / / / / / c o n s o l e . i n f o ( r e s . d a t a . s h i p p i n g _ l i s t , ' 1 1 1 1 ' )
this . orderId = this . shipping_list [ 0 ] . shipping_id
/ / c o n s o l e . i n f o ( r e s . d a t a )
/ / / / c o n s o l e . l o g ( t h i s . s h i p p i n g _ l i s t [ 0 ] . s h i p p i n g _ i d )
this . cartselectshipping ( this . orderId )
if ( res . data . bonus_list ) {
this . bonus_list = res . data . bonus_list
}
this . total = res . data . tota l
this . totalnum = this . total . amoun t
uni . setStorageSync ( 'total' , ( res . data . total ) )
let ss = uni . getStorageSync ( 'total' )
/ / / / c o n s o l e . l o g ( s s , ' 0 0 0 0 ' )
/ / t h i s . t o t a l = r e s . d a t a . t o t a l
/ / t h i s . t o t a l n u m = t h i s . t o t a l . a m o u n t
/ / u n i . s e t S t o r a g e S y n c ( ' t o t a l ' , ( r e s . d a t a . t o t a l ) )
/ / l e t s s = u n i . g e t S t o r a g e S y n c ( ' t o t a l ' )
/ / / / c o n s o l e . l o g ( r e s . d a t a . t o t a l )
this . order = res . data . order
}
} )
/ / 获 取 红 包
let data = { _action : 'getuserbonus' }
var time = new Date ( ) ;
/ / v a r t o d a y = t i m e . g e t F u l l Y e a r ( )
/ / v a r m o n t h
/ / i f ( t i m e . g e t M o n t h ( ) + 1 < 1 0 ) {
/ / m o n t h = ' 0 ' + ( t i m e . g e t M o n t h ( ) + 1 ) . t o S t r i n g ( )
/ / }
/ / v a r d a t e = t i m e . g e t D a t e ( )
/ / v a r t i m e c u r r e n t = t o d a y . t o S t r i n g ( ) + m o n t h . t o S t r i n g ( ) + d a t e . t o S t r i n g ( )
var today = time . toLocaleString ( )
console . log ( time . toLocaleString ( ) )
defaultRequest2 ( data ) . then ( res => {
/ / / / c o n s o l e . i n f o ( r e s )
/ / / / / / / / c o n s o l e . i n f o ( r e s )
if ( res . error == 0 ) {
this . list = res . data
}
this . list = res . data
/ / / / c o n s o l e . l o g ( t h i s . l i s t [ 0 ] . t y p e _ m o n e y )
/ / t h i s . b o n u s = t h i s . l i s t [ 0 ] . t y p e _ m o n e y
/ / c o n s o l e . l o g ( t h i s . t o t a l . a m o u n t )
let list = [ ]
let list2 = [ ]
res . data . map ( item => {
let hb_time = new Date ( Date . parse ( item . use_end_date ) )
/ / c o n s o l e . l o g ( n e w D a t e ( D a t e . p a r s e ( i t e m . u s e _ e n d _ d a t e ) ) )
item . use = hb_time > new Date ( Date . parse ( today ) )
/ / t h i s . l i s t = [ ]
list . push ( item )
this . list = list
if ( parseFloat ( item . min_goods_amount ) < this .totalnum ) {
list2 . push ( item )
/ / t h i s . t o t a l . a m o u n t = s u m
/ / t h i s . T h e p o i n t ( )
/ / t h i s . u s e C o u p o n s ( 2 , l i s t 2 [ 0 ] )
/ / t h i s . t o t a l . a m o u n t = t h i s . t o t a l . a m o u n t
}
/ / c o n s o l e . l o g ( h b _ t i m e > n e w D a t e ( D a t e . p a r s e ( t o d a y ) ) )
} )
this . bonus = list2 [ 0 ] . type_money
this . bonus_id = list2 [ 0 ] . bonus_id
let sum = ( parseFloat ( this . total . amount ) - parseFloat ( this . bonus ) . toFixed ( 2 ) ) . toFixed ( 2 )
console . log ( sum )
this . total . amount = sum
/ / u n i . s e t S t o r a g e S y n c ( ' T o t a l ' , t h i s . t o t a l )
uni . setStorageSync ( 'totalsum' , sum )
console . log ( this . list )
}
} )
/ / 获 取 余 额
defaultRequest2 ( {
_action : 'getusersummarydata'
} ) . then ( res => {
/ / / / c o n s o l e . l o g ( r e s )
/ / / / / / / / c o n s o l e . l o g ( r e s )
if ( res . error == 0 ) {
this . count = res . data . user_info . user_money
/ / t h i s . c o u n t = 4 . 0 0
@ -584,15 +629,18 @@
} )
} ,
openMore ( i ) {
this . popup_index = i
this . popup_index = i
/ / c o n s o l e . l o g ( t h i s . p o p u p _ i n d e x )
if ( i == 1 ) {
this . isCoupons = true
if ( ! this . list ) {
uni . showToast ( {
icon : 'none' ,
title : 'No coupon available'
} )
return
} else {
this . isCoupons = true
}
if ( this . orderDate . allow_use_bonus == 0 ) {
uni . showToast ( {
@ -601,15 +649,24 @@
} )
return
}
} else if ( i == 3 ) {
this . isPoints = true
if ( this . orderDate . allow_use_integral == 0 ) {
}
if ( i == 3 ) {
if ( this . count > 0 ) {
this . isPoints = true
}
else {
uni . showToast ( {
icon : 'none' ,
title : 'Points cannot be used for this product'
} )
return
icon : 'none' ,
title : 'Points cannot be used for this product'
} )
}
/ / i f ( t h i s . o r d e r D a t e . a l l o w _ u s e _ i n t e g r a l = = 0 ) {
/ / u n i . s h o w T o a s t ( {
/ / i c o n : ' n o n e ' ,
/ / t i t l e : ' P o i n t s c a n n o t b e u s e d f o r t h i s p r o d u c t '
/ / } )
/ / r e t u r n
/ / }
} else {
if ( ! this . address ) {
uni . showToast ( {
@ -623,33 +680,40 @@
title : 'please select shipping method'
} )
}
else {
this . isShow = tru e
}
/ / e l s e {
/ / t h i s . i s S h o w = t r u e
/ / }
}
}
} ,
onLoad ( e ) {
/ / t h i s . c u r r e n t = 0
this . query = JSON . parse ( e . query )
this . orderId = e . orderId
this . order . shipping_id = e . orderId
/ / i f ( e . o r d e r I d ) {
/ / t h i s . o r d e r I d = e . o r d e r I d
/ / t h i s . o r d e r . s h i p p i n g _ i d = e . o r d e r I d
/ / }
this . orderId = 11
this . order . shipping_id = 11
/ / t h i s . b o n u s = i t e m . t y p e _ m o n e y
/ / t h i s . c a r t s e l e c t s h i p p i n g ( t h i s . o r d e r I d )
if ( this . orderId ) {
this . tag = 1
}
/ / / / c o n s o l e . l o g ( t h i s . o r d e r I d , ' / / / ' )
/ / / / c o n s o l e . l o g ( e . o r d e r I d )
this . getList ( )
this . cartselectshipping ( 11 )
} ,
onShow ( e ) {
this . getList ( )
uni . $once ( 'query' , ( query ) => {
/ / / / c o n s o l e . i n f o ( q u e r y )
/ / / / / / / / c o n s o l e . i n f o ( q u e r y )
if ( query . type == 'address' ) {
this . query . consignee = query . consignee
this . query . is_new = 0
/ / / / c o n s o l e . l o g ( t h i s . q u e r y )
/ / / / / / / / c o n s o l e . l o g ( t h i s . q u e r y )
this . getList ( )
}
} ) ;
@ -847,6 +911,8 @@
position : fixed ;
bottom : 0 ;
left : 0 ;
/ / m i n - h e i g h t : 2 0 0 r p x ;
/ / m a x - h e i g h t : 6 0 0 r p x ;
background - color : white ;
padding - left : 29.33 rpx ;
padding - right : 29.33 rpx ;