init
This commit is contained in:
1
wx05cb767e6530b48f/pages/flow/checkout.js
Normal file
1
wx05cb767e6530b48f/pages/flow/checkout.js
Normal file
@@ -0,0 +1 @@
|
||||
var o=getApp();Page({data:{nav_select:!1,options:{},address:null,exist_address:!1,goods:{},disabled:!1,hasError:!1,error:""},onLoad:function(o){this.data.options=o,console.log(o)},onShow:function(){this.getOrderData()},getOrderData:function(){var r=this,t=r.data.options,s=function(t){if(1!==t.code)return o.showError(t.msg),!1;t.data.has_error?(r.data.hasError=!0,r.data.error=t.data.error_msg,o.showError(r.data.error)):(r.data.hasError=!1,r.data.error=""),r.setData(t.data)};"buyNow"===t.order_type?o._get("order/buyNow",{goods_id:t.goods_id,goods_num:t.goods_num,goods_sku_id:t.goods_sku_id},(function(o){s(o)})):"cart"===t.order_type&&o._get("order/cart",{},(function(o){s(o)}))},selectAddress:function(){wx.navigateTo({url:"../address/"+(this.data.exist_address?"index?from=flow":"createa")})},submitOrder:function(){var r=this,t=r.data.options;if(r.data.disabled)return!1;if(r.data.hasError)return o.showError(r.data.error),!1;var s=function(r){if(-10===r.code)return o.showError(r.msg,(function(){wx.redirectTo({url:"../pays/pays"})})),!1;wx.redirectTo({url:"../pays/pays"})};r.data.disabled=!0,wx.showLoading({title:"正在处理..."}),"buyNow"===t.order_type?o._post_form("order/buyNow",{goods_id:t.goods_id,goods_num:t.goods_num,goods_sku_id:t.goods_sku_id},(function(o){console.log("success"),s(o)}),(function(o){console.log("fail")}),(function(){console.log("complete"),r.data.disabled=!1})):"cart"===t.order_type&&o._post_form("order/cart",{},(function(o){console.log("success"),s(o)}),(function(o){console.log("fail")}),(function(){console.log("complete"),r.data.disabled=!1}))}});
|
||||
1
wx05cb767e6530b48f/pages/flow/checkout.json
Normal file
1
wx05cb767e6530b48f/pages/flow/checkout.json
Normal file
@@ -0,0 +1 @@
|
||||
{"navigationBarTitleText":"订单确认","usingComponents":{}}
|
||||
74
wx05cb767e6530b48f/pages/flow/checkout.wxml
Normal file
74
wx05cb767e6530b48f/pages/flow/checkout.wxml
Normal file
@@ -0,0 +1,74 @@
|
||||
<view class="container p-bottom">
|
||||
<view catchtap="selectAddress">
|
||||
<view wx:if="{{address.address_id}}">
|
||||
<view class="b-f">
|
||||
<view class="flow-checkout-header">
|
||||
<text class="iconfont icon-dingwei1"></text>
|
||||
<view class="flow-header-left">
|
||||
<view class="flow-checkout-admin f-30 col-3">
|
||||
<text>{{address.name}}</text>
|
||||
<text>{{address.phone}}</text>
|
||||
<text class="col-m"></text>
|
||||
</view>
|
||||
<view class="flow-checkout-address"> {{address.region.province}} {{address.region.city}} {{address.region.region}} {{address.detail}} </view>
|
||||
</view>
|
||||
<view class="flow-header-right pr-12">
|
||||
<text class="iconfont icon-xiangyoujiantou user-orderJtou"></text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view wx:else>
|
||||
<view class="flow-checkout-header">
|
||||
<text class="iconfont icon-dingwei1"></text>
|
||||
<view class="flow-header-left">
|
||||
<view class="f-28 col-6">去选择配送地址 </view>
|
||||
</view>
|
||||
<view class="flow-header-right p-r15">
|
||||
<text class="iconfont icon-xiangyoujiantou user-orderJtou"></text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="m-top20">
|
||||
<view class="checkout_list " wx:for="{{goods_list}}" wx:key="this">
|
||||
<navigator url="../goods/index?goods_id={{item.goods_id}}">
|
||||
<view class="dis-flex flow-shopList" data-index="{{index}}">
|
||||
<view class="flow-list-left">
|
||||
<image mode="scaleToFill" src="{{item.image[0].file_path}}"></image>
|
||||
</view>
|
||||
<view class="flow-list-right">
|
||||
<text class="f-30 col-3 twolist-hidden">{{item.goods_name}}</text>
|
||||
<text class="f-26 col-7">{{item.goods_sku.goods_attr}}</text>
|
||||
<view class="flow-list-cont">
|
||||
<text class="flow-cont">¥{{item.goods_price}}</text>
|
||||
<text class="small">×{{item.total_num}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</navigator>
|
||||
</view>
|
||||
<view class="flow-num-box b-f padding-box">
|
||||
<text>共{{order_total_num}}件商品,合计:</text>
|
||||
<text class="flow-money col-m">¥{{order_total_price}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flow-all-money b-f padding-box m-top20">
|
||||
<view class="dis-flex flow-all-list">
|
||||
<text class="flex-five">商品总金额:</text>
|
||||
<view class="flex-five t-r">
|
||||
<text class="col-m">¥{{order_total_price}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flow-fixed-footer b-f m-top10">
|
||||
<view class="dis-flex chackout-box">
|
||||
<view class=" chackout-left pl-12 ">实付款: <text class="col-m">¥{{order_pay_price}}</text>
|
||||
</view>
|
||||
<view bindtap="submitOrder" class="chackout-right">
|
||||
<text class="flow-btn">提交订单</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<shortcut></shortcut>
|
||||
</view>
|
||||
1
wx05cb767e6530b48f/pages/flow/checkout.wxss
Normal file
1
wx05cb767e6530b48f/pages/flow/checkout.wxss
Normal file
@@ -0,0 +1 @@
|
||||
.checkout_list{background:#fff;border-bottom:1rpx solid #eee;padding:10px 15px 2px}.checkout_list .flow-shopList{border-bottom:1rpx solid #eee;padding:5rpx 0 10rpx}.checkout_list .flow-shopList:last-child{border-bottom:0}.flow-header-left{padding-left:90rpx}
|
||||
1
wx05cb767e6530b48f/pages/flow/index.js
Normal file
1
wx05cb767e6530b48f/pages/flow/index.js
Normal file
@@ -0,0 +1 @@
|
||||
var t=require("../../@babel/runtime/helpers/defineProperty"),o=getApp();Page({data:{goods_list:[],order_total_num:0,order_total_price:0,colourList:[],colour_id:0,hideNotice:!1,storeInfo:{}},onLoad:function(t){this.pays(),this.getColourList(),this.getStoreInfo()},onShow:function(){this.setData({isLogin:o.checkIsLogin()}),this.data.isLogin&&this.getCartList()},pays:function(){var t=this;o._get("index/payList",{},(function(o){var a=o.data;t.setData({payList:a})}))},getStoreInfo:function(){var t=this;o._get("index/getStoreInfo",{},(function(o){var a=o.data;console.log(a),t.setData({storeInfo:a.store})}))},switchNotice:function(){this.setData({hideNotice:!0})},getCartList:function(){var t=this;o._get("cart/lists",{},(function(o){t.setData(o.data)}))},getColourList:function(){var t=this;o._get("goods/getColourList",{},(function(o){var a=o.data;t.setData({colourList:a.list})}))},addCount:function(a){var e=this,i=a.currentTarget.dataset.index,s=a.currentTarget.dataset.skuId,r=e.data.goods_list[i],n=e.data.order_total_price;wx.showLoading({title:"加载中",mask:!0}),o._post_form("cart/add",{goods_id:r.goods_id,goods_num:1,goods_sku_id:s},(function(){var o;r.total_num++,e.setData((t(o={},"goods_list["+i+"]",r),t(o,"order_total_price",e.mathadd(n,r.goods_price)),o))}))},minusCount:function(a){var e=this,i=a.currentTarget.dataset.index,s=a.currentTarget.dataset.skuId,r=e.data.goods_list[i],n=e.data.order_total_price;r.total_num>1&&(wx.showLoading({title:"加载中",mask:!0}),o._post_form("cart/sub",{goods_id:r.goods_id,goods_sku_id:s},(function(){var o;r.total_num--,r.total_num>0&&e.setData((t(o={},"goods_list["+i+"]",r),t(o,"order_total_price",e.mathsub(n,r.goods_price)),o))})))},del:function(t){var a=this,e=t.currentTarget.dataset.goodsId,i=t.currentTarget.dataset.skuId;wx.showModal({title:"提示",content:"您确定要移除当前商品吗?",success:function(t){t.confirm&&o._post_form("cart/delete",{goods_id:e,goods_sku_id:i},(function(t){a.getCartList()}))}})},submit:function(t){wx.navigateTo({url:"../flow/checkout?order_type=cart"})},mathadd:function(t,o){return(Number(t)+Number(o)).toFixed(2)},mathsub:function(t,o){return(Number(t)-Number(o)).toFixed(2)},goShopping:function(){wx.switchTab({url:"../index/index"})}});
|
||||
1
wx05cb767e6530b48f/pages/flow/index.json
Normal file
1
wx05cb767e6530b48f/pages/flow/index.json
Normal file
@@ -0,0 +1 @@
|
||||
{"navigationBarTitleText":"购物车","usingComponents":{}}
|
||||
57
wx05cb767e6530b48f/pages/flow/index.wxml
Normal file
57
wx05cb767e6530b48f/pages/flow/index.wxml
Normal file
@@ -0,0 +1,57 @@
|
||||
<view class="container p-bottom">
|
||||
<view class="notice-wrap" hidden="{{hideNotice}}" wx:if="{{storeInfo.cart_notice.length>0}}">
|
||||
<view class="tongzhitext">
|
||||
<text class="tongzhi-text">{{storeInfo.cart_notice}}</text>
|
||||
</view> <view bindtap="switchNotice" class="closeView">x</view>
|
||||
</view>
|
||||
<view class="flow-list">
|
||||
<view wx:if="{{goods_list.length}}">
|
||||
<view wx:for="{{goods_list}}" wx:key="this">
|
||||
<view class="dish-item" data-index="{{index}}" style="{{item.txtStyle}}">
|
||||
<view class="dish-item-wrp">
|
||||
<navigator hoverClass="none" url="../goods/index?goods_id={{item.goods_id}}">
|
||||
<view class="dish-item-pic">
|
||||
<image class="image" src="{{item.image[0].file_path}}"></image>
|
||||
</view>
|
||||
</navigator>
|
||||
<view class="dish-item-info">
|
||||
<navigator hoverClass="none" url="../goods/index?goods_id={{item.goods_id}}">
|
||||
<view class="goods-name">
|
||||
<text class="twolist-hidden f-30 col-3">
|
||||
<text class="colour-box f-20" wx:if="{{item.colour>0}}">{{colourList[item.colour]}}</text>{{item.goods_name}}</text>
|
||||
<view class="f-26" style="color: #555;"> {{item.goods_title.length>0?item.goods_title:' '}} </view>
|
||||
</view>
|
||||
<view class="goods-attr">
|
||||
<text class="col-7 f-24">{{item.goods_sku.goods_attr}}</text>
|
||||
</view>
|
||||
<view class="price f-30 col-m"> ¥{{item.goods_price}} <text class="del f-22" wx:if="{{item.goods_sku.line_price>0}}">{{item.goods_sku.line_price}}</text>
|
||||
</view>
|
||||
<view class="goods-attr">
|
||||
<text class="col-7 f-24" style="color: red;">请30分钟内提交结算,否则商品将自动移除</text>
|
||||
</view>
|
||||
</navigator>
|
||||
<view catchtap="del" class="flow-dete" data-goods-id="{{item.goods_id}}" data-sku-id="{{item.goods_sku_id}}">
|
||||
<text class="iconfont icon-lajixiang"></text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="cart-tab-wrp" wx:if="{{payList.res.st}}">
|
||||
<view class="cart-item-total cart-tab-item">
|
||||
<text class="cart-item-total-price h4">合计:¥{{order_total_price}}</text>
|
||||
</view>
|
||||
<view class="cart-tab-item">
|
||||
<view bindtap="submit" class="cart-tab-item-btn h4">去结算</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view wx:else>
|
||||
<view class="yoshop-notcont">
|
||||
<text class="iconfont icon-ziyuan"></text>
|
||||
<text class="cont">亲,购物车还没有商品哦</text>
|
||||
<view bindtap="goShopping" class="flow-btn-min">去逛逛</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
1
wx05cb767e6530b48f/pages/flow/index.wxss
Normal file
1
wx05cb767e6530b48f/pages/flow/index.wxss
Normal file
@@ -0,0 +1 @@
|
||||
@import "/wxParse/wxParse.wxss";.image{height:100%;width:100%}.cart-tab-item-btn{background:#ff495e;color:#fff;display:block;float:right;font-size:32rpx;height:100rpx;line-height:100rpx;text-align:center;width:160rpx}.price{margin-top:10rpx}.colour-box{background:#e64340;color:#fff;font-size:26rpx;line-height:26rpx;margin-right:10rpx;padding:4rpx 8rpx;text-align:center}.cart-tab-item{width:375rpx}.cart-tab-wrp{background:#fff;border-top:1rpx solid #ddd;bottom:0rpx;color:#000;display:-webkit-flex;display:flex;flex-direction:row;height:100rpx;position:fixed;width:100%;z-index:10}.cart-tab-item{line-height:100rpx;overflow:hidden}.cart-tab-item .cart-item-total-price{float:left}.cart-item-total{padding-left:30rpx}.cart-item-total-price{color:#ff495e;font-size:32rpx;text-align:center}.cart-item-total-price em{display:block}.cart-item-icon-wrp{height:90rpx;position:absolute;top:-4rpx;width:110rpx}.cart-item-icon{height:90rpx;width:90rpx}.dish-item{background:#fff;border-bottom:1rpx solid #eee;padding:26rpx 0;position:relative;width:100%}.dish-item-wrp{display:-webkit-flex;display:flex;flex-direction:row;width:100%}.dish-item-pic{margin-left:15px;width:100%}.dish-item-pic image{background:#fff;border:1rpx solid #eee;height:200rpx;margin:0 auto;width:200rpx}.dish-item-info{margin-right:15px;padding-left:16rpx;width:68%}.dish-item-sales{color:#ccc;font-size:20rpx;line-height:50rpx}.dish-item-money{color:#ff495e;font-size:32rpx;padding:0 0 10rpx}.wx-goods_price .dish-item-money{float:left}.wx-goods_price{overflow:hidden}.flow-dete{bottom:25rpx;position:absolute;right:30rpx}.flow-dete .icon-lajixiang{color:#777;font-size:34rpx}.flow-btn-min{background:#fff;border:1rpx solid #ccc;border-radius:5px;color:#777;font-size:28rpx;height:30px;line-height:30px;margin:25rpx auto 0;text-align:center;width:200rpx}@-webkit-keyframes remindMessage{0%{-webkit-transform:translateX(90%)}100%{-webkit-transform:translateX(-180%)}}@keyframes remindMessage{0%{-webkit-transform:translateX(90%)}100%{-webkit-transform:translateX(-180%)}}.tongzhitext{margin-left:10rpx;margin-right:80rpx;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.tongzhi-text{animation:remindMessage 14s linear infinite;display:block}.notice-wrap,.tongzhi-text{color:#d09868;font-size:28rpx;width:100%}.notice-wrap{background:#ffebda;height:60rpx;line-height:60rpx}.closeView{font-size:35rpx;height:45rpx;line-height:45rpx;position:absolute;right:20rpx;text-align:center;top:5rpx;width:45rpx}
|
||||
Reference in New Issue
Block a user