diff --git a/App.vue b/App.vue index 4e0f5a6..e896560 100644 --- a/App.vue +++ b/App.vue @@ -1,5 +1,6 @@ - - - - - - \ No newline at end of file + diff --git a/pages/account/index.vue b/pages/account/index.vue index 701d509..c212e59 100644 --- a/pages/account/index.vue +++ b/pages/account/index.vue @@ -62,10 +62,10 @@ My Service - + {{ item.block_title }} - + - + - + + + + Coupons + + + + + ${{item.type_money}} + Min.spend + ${{item.min_goods_amount}} + + + + {{item.type_name}} + The tide zone is available + {{item.use_start_date}} - {{item.use_end_date}} + + + + + + + + + + + + + + + + + + Points (total:{{ count}} ) + + + + + + + Use points + + + + + Do not use points + + + @@ -220,6 +269,7 @@ goods_list:[], shipping_list:[], bonus_list:[], + bonus:0, total:{}, order:{ shipping_id:11 @@ -228,32 +278,126 @@ pay_index:0, tag:0, orderId:0, + list:[] ,//红包列表 + current:-1, + count:0, + Points:0, + use:false, + nouse:true, + 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:{ // 使用红包 - useCoupons(id){ + useCoupons(index,item){ + // this.current = index + let total = this.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) + 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} - defaultRequest3(data,'consignee').then(res=>{ - - if(res.error==0){ - this.total=res.data.total - this.order=res.data.order - this.orderId=res.data.order.shiping_id - } + 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) + //使用了余额 + // console.log(this.count,this.total.amount,this.Points) + 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 + } + + + } + + + + //不使用 + else{ + this.Points = 0 + //console.log(222) + } + + + } + }) + + } + else{ + this.bonus = 0 + this.total = uni.getStorageSync('total') + this.bouns_id = 0 + // this.Points = this.total.amount + //console.log(this.total) + } + }, + 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) + ////console.info(data,'支付') + //console.log(res) if(res.error == 0){ - if(res.data.need_pay_amount==0) return + if(res.data.need_pay_amount==0) + this.isShow = false + { + setTimeout(() =>{ + uni.showToast({ + icon:'none', + title:'ok!' + }) + },2000) + uni.navigateTo({ + url:'../account/myOrders' + }) + } // plus.runtime.openURL(res.data.prepay_data.checkoutnow_url) // this.src = res.data.prepay_data.checkoutnow_url uni.navigateTo({ @@ -265,21 +409,36 @@ }else{ data={_action:'payorder',order_id:id,order_type:'GOODSBUY',payment_method:'alipay.native'} defaultRequest2(data).then(res=>{ - console.info(res,'支付宝') + //console.info(res,'支付宝') if(res.error==0){ //订单对象,从服务器获取 - if(res.data.need_pay_amount==0) return + 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) { - console.log('success:' + JSON.stringify(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)); + ////console.log('fail:' + JSON.stringify(err)); uni.redirectTo({ url: 'paySuccess?type=1&order_id='+id+'&will_get_integral='+will_get_integral }); @@ -290,6 +449,54 @@ } + }, + Thepoint(){ + //使用余额 使用红包 + ////console.log(this.total) + if(this.use && this.current!=-1){ + 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 + //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) + } + } + //使用红包 + else if(!this.use&& this.current!=-1){ + this.Points = 0 + this.total = uni.getStorageSync('Total') + } + // 都不使用 + else if(!this.use&& this.current==-1){ + 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) + } + } + }, // 选择支付方式 selectPay(index){ @@ -307,14 +514,16 @@ _action:'submitorder', consignee:this.address, postscript:'', - bonus:this.order.bonus, - surplus:this.order.surplus, + 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(data) + //console.info(res) + //console.log(data) if(res.error==0){ this.getPayDate(res.data.order.order_id,res.data.will_get_integral) } @@ -324,7 +533,7 @@ cartselectshipping(id){ let data={_action:'cartselectshipping',shipping_id:id,consignee:this.address} defaultRequest3(data,'consignee').then(res=>{ - console.info(res) + ////console.info(res) if(res.error==0){ this.tag = 1 this.total=res.data.total @@ -335,26 +544,50 @@ }, getList(){ defaultRequest3(this.query,'consignee').then(res=>{ - console.log(this.query) - console.info(res) + ////console.log(this.query) + ////console.info(res) if(res.error==0){ this.orderDate=res.data this.address=res.data.consignee this.goods_list=res.data.goods_list this.shipping_list=res.data.shipping_list - console.info(res.data.shipping_list,'1111') + // ////console.info(res.data.shipping_list,'1111') if(res.data.bonus_list){ this.bonus_list=res.data.bonus_list } this.total=res.data.total + this.totalnum = this.total.amount + uni.setStorageSync('total',(res.data.total)) + let ss = uni.getStorageSync('total') + ////console.log(ss,'0000') this.order=res.data.order } }) + // 获取红包 + let data={_action:'getuserbonus'} + defaultRequest2(data).then(res=>{ + ////console.info(res) + if(res.error==0){ + this.list=res.data + } + }) + //获取余额 + 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 if(i==1){ - if(this.bonus_list.length==0){ + this.isCoupons = true + if(!this.list){ uni.showToast({ icon:'none', title:'No coupon available' @@ -369,7 +602,7 @@ return } }else if(i==3){ - + this.isPoints = true if(this.orderDate.allow_use_integral==0){ uni.showToast({ icon:'none', @@ -405,18 +638,18 @@ if(this.orderId){ this.tag =1 } - console.log(this.orderId,'///') + ////console.log(this.orderId,'///') this.getList() }, onShow(e) { this.getList() uni.$once('query' ,(query)=>{ - console.info(query) + ////console.info(query) if(query.type=='address'){ this.query.consignee=query.consignee this.query.is_new=0 - console.log(this.query) + ////console.log(this.query) this.getList() } }); @@ -608,5 +841,70 @@ margin: 0; } } - + // 红包 + .coupons{ + z-index: 999; + position: fixed; + bottom: 0; + left: 0; + 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; + .order_popup_title{ + position: relative; + font-size: 32rpx; + font-weight: bold; + border-bottom: 1px solid #E2E2E2; + display: flex; + color:#000; + align-items: center; + justify-content: center; + // padding-top: 44.67rpx; + padding-bottom: 20.67rpx; + text-align: center; + image{ + width: 21.33rpx; + height: 21.33rpx; + 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: 63.33rpx; + padding-left: 47.33rpx; + padding-top: 34.67rpx; + font-size: 28rpx; + + .points_item{ + display: flex; + align-items: center; + margin-bottom: 40rpx; + &:last-child{ + margin-bottom: 0; + } + + image{ + width: 29.33rpx; + height: 29.33rpx; + margin-right: 26rpx; + + } + } + } + } \ No newline at end of file diff --git a/pages/productDetails/index.vue b/pages/productDetails/index.vue index f56e73c..e389660 100644 --- a/pages/productDetails/index.vue +++ b/pages/productDetails/index.vue @@ -473,6 +473,7 @@ shipping_list:[], Size_list:'', shop_price:0, + first:0, @@ -798,17 +799,19 @@ if(res.error==0){ console.log(res.data,'222') this.goodsDate=res.data - - if(this.goodsDate.comment_list.length<2){ - this.commonlist.push(this.goodsDate.comment_list[0]) - }else if(this.goodsDate.comment_list.length == 0){ - this.commonlist = [] - } - else{ - for(let i =0;i<2;i++){ - this.commonlist.push(this.goodsDate.comment_list[i]) + if(this.goodsDate.comment_list) + { + if(this.goodsDate.comment_list.length<2){ + this.commonlist.push(this.goodsDate.comment_list[0]) + }else if(this.goodsDate.comment_list.length == 0){ + this.commonlist = [] + } + else{ + for(let i =0;i<2;i++){ + this.commonlist.push(this.goodsDate.comment_list[i]) + } + } - } console.log(this.commonlist,'11') @@ -888,7 +891,14 @@ }) }, back(){ - uni.navigateBack() + if(this.first == 2){ + uni.navigateTo({ + url:'../category/index' + }) + } + else{ + uni.navigateBack() + } }, // 分享1复制 Copylink(){ @@ -938,7 +948,9 @@ onLoad(e) { // let goods = JSON.parse(e) this.isLogin = uni.getStorageSync('isLogin') - + if(e.first){ + this.first = e.first + } //console.log(e,'p') this.query.goods_id=e.goodid @@ -1255,7 +1267,7 @@ .active_color{ color: #B22234;; background-color: white; - // border: 1px solid #000000; + border: 1px solid #000000; } } .variations_select_size{ diff --git a/pages/productDetails/review.vue b/pages/productDetails/review.vue index 0534b7a..54df62f 100644 --- a/pages/productDetails/review.vue +++ b/pages/productDetails/review.vue @@ -1,6 +1,6 @@