瀏覽代碼

no message

una 4 月之前
父節點
當前提交
b171c0b22f
共有 5 個文件被更改,包括 352 次插入16 次删除
  1. 1 0
      api/mall.js
  2. 6 6
      pages/mall/cart/cart.js
  3. 69 6
      pages/mall/checkout/checkout.js
  4. 82 3
      pages/mall/checkout/checkout.wxml
  5. 194 1
      pages/mall/checkout/checkout.wxss

+ 1 - 0
api/mall.js

@@ -60,4 +60,5 @@ module.exports = {
 	 getDetailInfo:WxApiRoot + 'telecomCard/getDetailInfo',
 	 saveOrder:WxApiRoot + 'telecomCard/saveOrder',  
 	 selectNumber:WxApiRoot + 'telecomCard/selectNumber',  
+	 AddressList:WxApiRoot + 'address/list', 
 }

+ 6 - 6
pages/mall/cart/cart.js

@@ -189,7 +189,7 @@ Page({
   getCheckedGoodsCount: function () {
     let checkedGoodsCount = 0;
     this.data.cartGoods.forEach(function (v) {
-      if (v.checked === true) {
+      if (v.checked == true) {
         checkedGoodsCount += v.number;
       }
     });
@@ -199,7 +199,7 @@ Page({
   getCheckedGoodsAmount: function () {
     let checkedGoodsAmount = 0;
     this.data.cartGoods.forEach(function (v) {
-      if (v.checked === true) {
+      if (v.checked == true) {
         checkedGoodsAmount += v.number * v.price;
       }
     });
@@ -210,7 +210,7 @@ Page({
 
     if (!this.data.isEditCart) {
       var productIds = this.data.cartGoods.map(function (v) {
-        return v.commoditySkuId;
+        return v.skuId;
       });
       util.request(mall.CartChecked, {
         productIds: productIds,
@@ -273,7 +273,7 @@ Page({
     util.request(mall.CartUpdate, {
       id:cartItem.id,
       commodityId:cartItem.commodityId,
-      commoditySkuId:cartItem.commoditySkuId,
+      commoditySkuId:cartItem.skuId,
       number:number
     }, 'POST').then(res=> {
       console.log(res);
@@ -284,7 +284,7 @@ Page({
         this.setData({
           [cartItem]:number,
         });
-        console.log(this.cartGoods);
+        console.log(this.data.cartGoods);
     this.setData({
      
       'cartTotal.checkedGoodsAmount': that.getCheckedGoodsAmount(),
@@ -440,7 +440,7 @@ console.log(arr);
     let that = this;
     console.log(cartItem);
     util.request(mall.CartDelete, {
-      productIds:[cartItem.commoditySkuId],
+      productIds:[cartItem.skuId],
     }, 'POST').then(function (res) {
       console.log(res.data);
       if (res.errno === 0) {

+ 69 - 6
pages/mall/checkout/checkout.js

@@ -6,6 +6,12 @@ var app = getApp();
 
 Page({
   data: {
+		addressList:[],
+		address:{
+			detail:'',
+			name:'',
+			tel:''
+		},
     shopAddress:'',//门店地址
     buyNumber:'',
     memberDiscount: '',
@@ -114,18 +120,20 @@ Page({
       // userCouponId: that.data.userCouponId,
       // grouponRulesId: that.data.grouponRulesId,
       // shareId: that.data.shareId,
-    },'POST').then(function (res) {
+    },'POST').then(res=> {
       
       wx.hideLoading();
       console.log(res);
-      if (res.errno === 0) {
+      if (res.errno == 0) {
+
         that.setData({
           // isMember: res.data.isMember,
           // memberDiscount: res.data.memberDiscount,
           checkedGoodsList: res.data.skus,
           shopAddress:res.data.address,
           buyNumber:res.data.buyNumber,
-          actualPrice: res.data.price,
+					actualPrice: res.data.price,
+					addressId:res.data.addressId
           // checkedAddress: res.data.checkedAddress,
           // availableCouponLength: res.data.availableCouponLength,
           // couponPrice: res.data.couponPrice,
@@ -138,7 +146,10 @@ Page({
           // userCouponId: res.data.userCouponId,
           // grouponRulesId: res.data.grouponRulesId,
          
-        });
+				});
+				if (res.data.addressId) {
+					this.getAddressList();
+			}
        
         // that.LimitCanAppointmentDate();
 
@@ -425,8 +436,31 @@ Page({
   },
 
   orderPay() {
+		  if(this.data.addressId==null||this.data.addressId==''){
+				if(this.data.address.detail==''){
+					util.showErrorToast('请输入收货地址');
+					return false;
+				}
+				if(this.data.address.name==''){
+					util.showErrorToast('请输入联系人');
+					return false;
+				}
+				if(this.data.address.tel==''){
+					util.showErrorToast('请输入联系电话');
+					return false;
+				}
+				let reg=/^1\d{10}$/;
+				if(!reg.test(this.data.address.tel)){
+					util.showErrorToast('电话号码格式不正确');
+					return false;
+				}
+			}
     var orderInfo = {
-      cartId: ['this.data.cartId'],
+			cartId: [this.data.cartId],
+			addressId:this.data.addressId,
+			receiverAddress:this.data.address.detail,
+			receiverName:this.data.address.name,
+			receiverPhone:this.data.address.tel
       
     };
 
@@ -1152,7 +1186,36 @@ Page({
     wx.navigateTo({
       url: "/pages/member/buyMember/buyMember"
     });
-  },
+	},
+	addressConfirm(e) {
+		let address = e.currentTarget.dataset.address;
+		this.setData({
+				checkedAddress: address,
+				addressShow: false
+		});
+},
+getAddressList() {
+	util.request(mall.AddressList).then((res) => {
+			if (res.errno === 0) {
+					this.setData({
+							addressList: res.data.list
+					});
+					let current = this.data.addressList.filter((item) => {
+							return item.id == this.data.addressId;
+					});
+					if (current.length > 0) {
+							this.setData({
+									checkedAddress: current[0]
+							});
+					}
+			}
+	});
+},
+addressSelect() {
+	this.setData({
+			addressShow: true
+	});
+},
 
 
 

+ 82 - 3
pages/mall/checkout/checkout.wxml

@@ -3,19 +3,98 @@
 <view class="container">
   <view class="address-box">
   
-    <view class="address-item address-empty" >
+    <!-- <view class="address-item address-empty" >
       <image class="map-icon" mode="aspectFit" src='/static/images/new/dingwei.png'></image>
       <view class="m">
         {{shopAddress}}
       </view>
       <view class="r">
-        <!-- <van-icon name="arrow" /> -->
+     
       </view>
+    </view> -->
+
+      <!-- 有地址,选择 -->
+    <view wx:if="{{addressId>0}}" class="address-select" bindtap="addressSelect">
+      <image mode="aspectFit" src="https://jzmall.lifejingzhi.com/file/jzmall-dy/icon-order-map.png" class="map-img">
+      </image>
+
+      <view class="address-main">
+        <view class="main-line">
+          <view>{{checkedAddress.receiverName}}</view>
+          <view class="phone">{{checkedAddress.receiverPhone}}</view>
+        </view>
+        <view class="customer-address">{{checkedAddress.receiverAddress}}</view>
+       
+      </view>
+      <image mode="aspectFit" src="https://jzmall.lifejingzhi.com/file/wx-dy/arrow-grey.png" class="arrow-img"></image>
+
     </view>
+    <!-- 没地址,输入 -->
+    <view wx:else class="address-input-module add-address">
+      <view class="add-form">
+        <!-- <view class="form-item" bindtap="goMap" style="height:auto;min-height:78rpx; ">
+          <view class="label"><text>*</text>服务地址</view>
+          <view class="content" style="height:auto;min-height:78rpx; ">
+            <view wx:if="{{address.addressname==''}}" style="color: #ACADB1;;font-size:24rpx;" class="input">
+              选择省、市、县(区)、乡(镇)
+            </view>
+            <view wx:else class="input"> {{address.addressname}}</view>
+         
+
+            <image src="https://jzmall.lifejingzhi.com/file/jzmall-dy/icon-address-map.png"
+              style="width: 28rpx;height: 28rpx;margin:28rpx 0 0 10rpx;"></image>
+          </view>
+        </view> -->
+        <view class="form-item">
+          <view class="label"><text>*</text>收货地址</view>
+          <view class="content">
+            <input class="input" bindinput="bindinputAddress" value="{{address.detail}}"
+              placeholder="请输入收货地址" placeholder-style="color: #ACADB1;;font-size:24rpx;" />
+          </view>
+        </view>
+        <view class="form-item">
+          <view class="label"><text>*</text>联系人</view>
+          <view class="content special-content">
+            <input class="input" bindinput="bindinputName" placeholder="姓名" value="{{address.name}}" auto-focus
+              placeholder-style="color: #ACADB1;;font-size:24rpx;" />
+            <!-- <view class="gender-wrapper">
+              <view class="female" bindtap="femaleSelect">
+                <image src="https://mall.zhaijieshi.cc/file/jzmall-dy/icon-select-popup.png" mode="asceptFit"
+                  wx:if="{{gender==2}}"></image>
+                <image src="https://mall.zhaijieshi.cc/file/jzmall-dy/icon-unselect-popup.png" mode="asceptFit" wx:else>
+                </image>
+                <text>女士</text>
+              </view>
+              <view class="male" bindtap="maleSelect">
+                <image src="https://jzmall.lifejingzhi.com/file/jzmall-dy/icon-select-popup.png" mode="asceptFit"
+                  wx:if="{{gender==1}}"></image>
+                <image src="https://mall.zhaijieshi.cc/file/jzmall-dy/icon-unselect-popup.png" mode="asceptFit" wx:else>
+                </image>
+                <text>先生</text>
+              </view>
+
+
+            </view> -->
+
+          </view>
+        </view>
+        <view class="form-item">
+          <view class="label"><text>*</text>联系电话</view>
+          <view class="content">
+            <input class="input" bindinput="bindinputMobile" value="{{address.tel}}" type="number" placeholder="手机号码"
+              maxlength="11" placeholder-style="color: #ACADB1;;font-size:24rpx;" />
+          </view>
+        </view>
+
+
 
 
 
-		
+
+      </view>
+    </view>
+
+
   </view>
  
 

+ 194 - 1
pages/mall/checkout/checkout.wxss

@@ -708,4 +708,197 @@ background: linear-gradient(177deg, #F1E3C8 0%, #E6C162 100%);
 .popup-content-special .time-select-left{
   height: 900rpx;
   overflow-y: scroll;
-}
+}
+
+  /* 顶部地址 */
+  .address-select {
+    padding: 22rpx 24rpx 22rpx 30rpx;
+    background: #FFFFFF;
+    border-radius: 24rpx;
+    display: flex;
+    align-items: center;
+    min-height: 132rpx;
+  }
+  
+  .address-select .map-img {
+    width: 48rpx;
+    height: 48rpx;
+    margin-right: 24rpx;
+  
+  }
+  
+  .address-main {
+    display: flex;
+    flex-direction: column;
+    flex: 1;
+  }
+  
+  .address-main .main-line {
+    display: flex;
+    height: 44rpx;
+    margin-bottom: 4rpx;
+    align-items: center;
+  }
+  
+  .main-line view {
+    color: #333333;
+    font-size: 32rpx;
+  }
+  
+  .main-line view.phone {
+    color: #999999;
+    font-size: 24rpx;
+    margin-left: 14rpx;
+  }
+  
+  .customer-info .customer-address {
+    color: #666666;
+    line-height: 40rpx;
+  }
+  
+  .address-select .arrow-img {
+    width: 28rpx;
+    height: 28rpx;
+    margin-left: 20rpx;
+  }
+  
+  /* 地址选择 */
+  .appoint-overlay-wrapper.address-overlay {
+    display: flex;
+    align-items: flex-end;
+  }
+  
+  .address-popup {
+    width: 750rpx;
+    padding: 0 24rpx 0rpx;
+    background: #FFFFFF;
+    border-radius: 56rpx 56rpx 0 0;
+  }
+  
+  .address-popup .title {
+    font-weight: 600;
+    color: #191919;
+    font-size: 28rpx;
+    height: 122rpx;
+    line-height: 122rpx;
+    text-align: center;
+  }
+  
+  .address-list {
+    height: 720rpx;
+    overflow-y: scroll;
+    padding-bottom: 20rpx;
+  }
+  
+  .address-popup .add-address-btn {
+    width: 654rpx;
+    margin: 40rpx 24rpx 40rpx;
+    height: 90rpx;
+    background: linear-gradient(90deg, #00BAFF 0%, #008DFF 100%);
+    border-radius: 45rpx;
+    font-size: 36rpx;
+    text-align: center;
+    color: rgba(255, 255, 255, 0.9);
+    line-height: 90rpx;
+  }
+  
+  .address-item {
+    width: 702rpx;
+    display: flex;
+    align-items: center;
+    min-height: 132rpx;
+    border-radius: 24rpx;
+    border: 2rpx solid #E3E3E3;
+    margin-bottom: 30rpx;
+  }
+  
+  .address-item .arrow-img {
+    width: 28rpx;
+    height: 28rpx;
+    margin-left: 20rpx;
+  }
+  
+  .address-item .map-img {
+    width: 48rpx;
+    height: 48rpx;
+    margin-right: 24rpx;
+  
+  }
+  
+  /* 地址输入 */
+  .add-address .add-form {
+    background: #fff;
+    width: 702rpx;
+    border-radius: 25rpx;
+    padding: 4rpx 24rpx 24rpx;
+  }
+  
+  .add-address .form-item {
+    height: 78rpx;
+    display: flex;
+    align-items: center;
+  }
+  
+  .add-address .input {
+    flex: 1;
+    /* height: 78rpx; */
+    /* line-height: 44rpx; */
+    /* overflow: hidden; */
+    font-size: 26rpx;
+    color: #333;
+    padding-top: 24rpx;
+  }
+  
+  .add-address .label {
+    font-size: 26rpx;
+    font-weight: bold;
+    width: 160rpx;
+    text-align: left;
+    color: rgba(0, 0, 0, 0.9);
+  }
+  
+  .add-address .label text {
+    color: #FF0000;
+  }
+  
+  .add-address .content {
+    border-bottom: 2rpx solid #E0E0E0;
+    /* height: 88rpx; */
+    /* line-height: 88rpx; */
+    align-content: center;
+    flex: 1;
+    display: flex;
+    align-items: center;
+    padding-bottom: 8rpx;
+    height: 78rpx;
+  }
+  
+  .gender-wrapper image {
+    width: 26rpx;
+    height: 26rpx;
+    margin-right: 10rpx;
+  }
+  
+  .gender-wrapper {
+    display: flex;
+    /* align-items: center;
+     */
+  
+    height: 78rpx;
+    justify-content: space-between;
+    width: 220rpx;
+  }
+  
+  .male,
+  .female {
+    display: flex;
+    align-items: center;
+    height: 78rpx;
+    padding-top: 24rpx;
+  }
+  
+  .male text,
+  .female text {
+    color: #ACADB1;
+    font-size: 24rpx;
+  }