소스 검색

地址的添加

wangyong 6 년 전
부모
커밋
8c97862a3a

+ 3 - 2
app.json

@@ -100,9 +100,10 @@
         "pages/made/comb/comb",
         "pages/made/comb/comb",
         "pages/canvas/canvas",
         "pages/canvas/canvas",
         "pages/car/car",
         "pages/car/car",
-        "pages/order/order",
+        "pages/accounts/accounts",
         "pages/address/address",
         "pages/address/address",
-        "pages/user/user"
+        "pages/user/user",
+        "pages/address/add/add"
       ]
       ]
     }
     }
   ],
   ],

BIN
customized/images/customized/tu_icon.png


+ 5 - 0
customized/pages/order/order.js

@@ -95,5 +95,10 @@ Page({
         console.log(res)
         console.log(res)
       }
       }
     })
     })
+  },
+  addressBtn(){
+    wx.navigateTo({
+      url: '/customized/pages/address/address',
+    })
   }
   }
 })
 })

customized/pages/order/order.json → customized/pages/accounts/accounts.json


+ 8 - 10
customized/pages/order/order.wxml

@@ -1,23 +1,21 @@
 <!-- 地址 -->
 <!-- 地址 -->
-<view class='address-box bg-white'>
-  <view class='mar-l20 mar-r20 f-box'>
-  <icon class='iconfont icon-dizhi mar-r20 f-box f-align-items-center c-orange'></icon>
+<view class='address-box bg-white c-333'>
+  <view class='mar-l20 mar-r20 f-box' bindtap='addressBtn'>
+    <icon class='iconfont icon-dizhi mar-r20 f-box f-align-items-center c-orange' style='font-size:50rpx;'></icon>
     <view class='address-infor f-item'>
     <view class='address-infor f-item'>
       <view class='f-box f-s30'><text>阿哥子</text><text>18888888888</text></view>
       <view class='f-box f-s30'><text>阿哥子</text><text>18888888888</text></view>
-      <view class='mar-t20 f-s30'>
-        上海市 闵行区 虹漕路88号
-      </view>
+      <view class='mar-t20 f-s30'>上海市 闵行区 虹漕路88号</view>
     </view>
     </view>
     <view class='arrow'></view>
     <view class='arrow'></view>
   </view>
   </view>
 </view>
 </view>
 <!-- 订单 -->
 <!-- 订单 -->
-<view class='goodsList-box mar-t20 bg-white'>
+<view class='goodsList-box mar-t20 bg-white c-333'>
   <view  class='goods-list' wx:for="{{goodsList}}">
   <view  class='goods-list' wx:for="{{goodsList}}">
       <view class='mar-r20 mar-l20'>
       <view class='mar-r20 mar-l20'>
         <text class='f-s30'>{{item.customGoodsName}}</text>
         <text class='f-s30'>{{item.customGoodsName}}</text>
-        <view  class='f-box f-align-items-center f-s28' style='margin:20rpx 0;'>
-          <text class='f-item'>¥{{item.customgoodsPriceNow}}</text>
+        <view  class='f-box f-align-items-center f-s28 mar-t20 mar-b20'>
+          <text class='f-item f-s30 c-orange'>¥{{item.customgoodsPriceNow}}</text>
           <view> × {{item.customGoodsNum}}</view>
           <view> × {{item.customGoodsNum}}</view>
         </view>
         </view>
       </view>      
       </view>      
@@ -29,7 +27,7 @@
 </view>
 </view>
 
 
 <!-- 其他内容,邮费/备注等 -->
 <!-- 其他内容,邮费/备注等 -->
-<view class='other-box bg-white mar-t20'>
+<view class='other-box bg-white mar-t20 c-333'>
   <view class='mar-l20 mar-r20 f-s28'>
   <view class='mar-l20 mar-r20 f-s28'>
     <view class='other-list f-box'>
     <view class='other-list f-box'>
         <view class="f-item">运费</view>
         <view class="f-item">运费</view>

customized/pages/order/order.wxss → customized/pages/accounts/order.wxss


+ 143 - 0
customized/pages/address/add/add.js

@@ -0,0 +1,143 @@
+// customized/pages/address/add/add.js
+let app = getApp();
+let host = app.globalData.servsers; // 请求的url
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    name:'',
+    phone:'',
+    region: ['上海市', '上海市', '黄浦区'],
+    detailAddress:'',
+    switchChecked:false, //是否默认
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload: function () {
+
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh: function () {
+
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom: function () {
+
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage: function () {
+
+  },
+  bindRegionChange(e) {
+    console.log('picker发送选择改变,携带值为', e.detail.value)
+    this.setData({
+      region: e.detail.value
+    })
+  },
+  switchChange(e){
+    this.setData({
+      switchChecked: e.detail.value
+    })
+  },
+  nameChange(e){
+    this.setData({
+      name: e.detail.value
+    })
+  },
+  phoneChange(e) {
+    this.setData({
+      phone: e.detail.value
+    })
+  },
+  addressInput(e){ // 详细地址
+  console.log(e)
+    this.setData({
+      detailAddress: e.detail.value
+    })
+  },
+  addAddress(){ // 保存地址
+    let that =this;
+    if(!that.data.name){
+      wx.showToast({
+        title: '收货人没有输入',
+        icon:"none"
+      });
+      return
+    }
+    if(!that.data.phone){
+      wx.showToast({
+        title: '手机号码没有输入',
+        icon: "none"
+      });
+      return
+    }
+    if (!that.data.detailAddress) {
+      wx.showToast({
+        title: '详细地址没有输入',
+        icon: "none"
+      });
+      return
+    }
+
+    wx.request({
+      url: host+'',
+      header: {
+        'content-type': 'application/x-www-form-urlencoded'
+      },
+      data:{
+        userId: app.globalData.user_id, //'oovpNwjlsY6xx8ceCebFa1dOLd9E',  //app.globalData.user_id,
+			  consignee: that.data.name, //收货人
+			  province:that.data.region[0],
+        city: that.data.region[1],
+        area: that.data.region[2],
+			  adress:that.data.detailAddress,
+			  phone:that.data.phone,
+        adress_flag: that.data.switchChecked ? 0 : 1  // 是否默认 0是 1 否
+      },
+      success(res){
+        console.log(res,"地址保存")
+      }
+    })
+  }
+})

+ 3 - 0
customized/pages/address/add/add.json

@@ -0,0 +1,3 @@
+{
+  "usingComponents": {}
+}

+ 43 - 0
customized/pages/address/add/add.wxml

@@ -0,0 +1,43 @@
+<view class='addressAdd-box mar-l20 mar-r20 f-s28'>
+  <view class='add-list f-box'>
+    <view class='add-label'>收货人</view>
+    <view class='f-item'><input placeholder="收货人姓名" value='{{name}}' bindinput="nameChange"  /></view>
+  </view>
+  <view class='add-list f-box'>
+    <view class='add-label'>手机号码</view>
+    <view class='f-item'><input placeholder="收货人手机号码" type='number' value='{{phone}}' bindinput="phoneChange"  /></view>
+  </view>
+  <view class='add-list f-box'>
+    <view class='add-label'>所在地区</view>
+    <view class='f-item'>
+    <picker mode="region"  bindchange="bindRegionChange" value="{{region}}" >
+      <view class="picker">
+        {{region[0]}} {{region[1]}} {{region[2]}}
+      </view>
+    </picker>
+    </view>
+  </view>
+  <view class='add-textarea f-box'>
+    <view class='add-label'>详细地址</view>
+    <view class='f-item'>
+      <textarea placeholder="详细地址~" value='{{detailAddress}}' bindinput="addressInput" placeholder-class="place-textarea"/>
+    </view>
+  </view>
+
+  <view class='switch'>
+    <view class="f-box f-align-items-center">
+        <view class='f-item'>是否默认</view>
+        <switch checked="{{switchChecked}}" color="#e8976a" bindchange="switchChange"/>
+    </view>
+  </view>
+</view>
+
+<view class='footer'>
+  <view class='footer-box'>
+    <view class='bg-orange c-white f-s32 f-box f-justify-content-center' bindtap='addAddress'>保存</view>
+  </view>
+</view>
+
+
+
+  

+ 30 - 0
customized/pages/address/add/add.wxss

@@ -0,0 +1,30 @@
+/* customized/pages/address/add/add.wxss */
+page{
+  background:#fff;
+}
+.add-list{
+  height:50rpx;
+  line-height:50rpx;
+  padding:30rpx 0;
+  border-bottom:2rpx solid #e0e0e0;
+}
+.add-label{
+  width:5em;
+}
+.add-label input{
+  width:100%;
+}
+.add-textarea{
+  border-bottom:2rpx solid #e0e0e0;
+  line-height:50rpx;
+  padding:30rpx 0;
+}
+.add-textarea textarea{
+  width:100%;
+  height:100rpx;
+  line-height:0;
+  margin-top:10rpx;
+}
+.switch{
+  margin-top:30rpx;
+}

+ 14 - 5
customized/pages/address/address.js

@@ -7,7 +7,7 @@ Page({
    * 页面的初始数据
    * 页面的初始数据
    */
    */
   data: {
   data: {
-    addressList:[],
+    addressList: [],
   },
   },
 
 
   /**
   /**
@@ -55,18 +55,27 @@ Page({
   /**
   /**
    * 页面上拉触底事件的处理函数
    * 页面上拉触底事件的处理函数
    */
    */
-  getaddress(){
+  getaddress() {
+    let that = this;
     wx.request({
     wx.request({
       url: host + '/adressapi/adressview',
       url: host + '/adressapi/adressview',
       header: {
       header: {
         'content-type': 'application/x-www-form-urlencoded'
         'content-type': 'application/x-www-form-urlencoded'
       },
       },
       data: {
       data: {
-        userId: 'oovpNwjlsY6xx8ceCebFa1dOLd9E'  //app.globalData.user_id,
+        userId: app.globalData.user_id,// 'oovpNwjlsY6xx8ceCebFa1dOLd9E'  //app.globalData.user_id,
       },
       },
-      success(res){
-        console.log(res,"address")
+      success(res) {
+        console.log(res, "address")
+        that.setData({
+          addressList:[...res.rows]
+        })
       }
       }
     })
     })
+  },
+  addAddress(){
+    wx.navigateTo({
+      url: '/customized/pages/address/add/add',
+    })
   }
   }
 })
 })

+ 3 - 3
customized/pages/address/address.wxml

@@ -1,12 +1,12 @@
 <!-- 地址列表 -->
 <!-- 地址列表 -->
-<view class='address-box'>
+<view class='address-box c-333'>
   <view class='address-list bg-white mar-b20'>
   <view class='address-list bg-white mar-b20'>
     <view class='mar-l20 mar-r20 pad-t20 pad-b20 f-s28'>
     <view class='mar-l20 mar-r20 pad-t20 pad-b20 f-s28'>
       <view>王勇 15055166539</view>
       <view>王勇 15055166539</view>
       <view>上海市 上海市 闵行区 虹漕路1467弄</view>
       <view>上海市 上海市 闵行区 虹漕路1467弄</view>
-      <view class='address-icon f-box'>
+      <view class='address-icon f-box mar-t20'>
         <view class='f-item f-box f-s24 f-align-items-center'>
         <view class='f-item f-box f-s24 f-align-items-center'>
-          <icon type="success" size="18" class='f-box f-align-items-center' color="orange" />
+          <icon type="success" size="16" class='f-box f-align-items-center' color="orange" />
           <text class='icon-font'>默认地址</text>
           <text class='icon-font'>默认地址</text>
         </view>
         </view>
         <view>
         <view>

+ 1 - 1
customized/pages/address/address.wxss

@@ -1,6 +1,6 @@
 /* customized/pages/address/address.wxss */
 /* customized/pages/address/address.wxss */
 .address-list{
 .address-list{
-  line-height:40rpx;
+  line-height:46rpx;
 }
 }
 .icon-font{
 .icon-font{
   margin-left:10rpx;
   margin-left:10rpx;

+ 1 - 1
customized/pages/car/car.js

@@ -125,7 +125,7 @@ Page({
       wx.setStorageSync('goodsList', carList);
       wx.setStorageSync('goodsList', carList);
       wx.setStorageSync('amount', that.data.amount);
       wx.setStorageSync('amount', that.data.amount);
       wx.navigateTo({
       wx.navigateTo({
-        url: '/customized/pages/order/order',
+        url: '/customized/pages/accounts/accounts',
       })
       })
     } else {
     } else {
       wx.showToast({
       wx.showToast({

+ 3 - 1
customized/pages/car/car.json

@@ -1,3 +1,5 @@
 {
 {
-  "usingComponents": {}
+ "usingComponents": {
+  "data-none": "/components/data-none/data-none"
+  }
 }
 }

+ 5 - 5
customized/pages/car/car.wxml

@@ -1,4 +1,4 @@
-<view>
+<view class='c-333'>
   <!-- 购物车列表 -->
   <!-- 购物车列表 -->
   <view class='car-box '>
   <view class='car-box '>
     <view  class='car-list  bg-white'  wx:for="{{carList}}"  wx:for-index="idx">
     <view  class='car-list  bg-white'  wx:for="{{carList}}"  wx:for-index="idx">
@@ -10,8 +10,8 @@
           </checkbox-group>
           </checkbox-group>
           <view class='f-item'>
           <view class='f-item'>
             <text class='f-s30'>{{item.customGoodsName}}</text>
             <text class='f-s30'>{{item.customGoodsName}}</text>
-            <view  class='f-box f-align-items-center' style='margin:20rpx 0;'>
-              <text class='f-item f-s28'>¥{{item.customgoodsPriceNow}}</text>
+            <view  class='f-box f-align-items-center mar-t20 mar-b20'>
+              <text class='f-item f-s30 c-orange'>¥{{item.customgoodsPriceNow}}</text>
               <view class='car-numBtn f-box'>
               <view class='car-numBtn f-box'>
                 <view bindtap='subtraction' data-index="{{idx}}">-</view>
                 <view bindtap='subtraction' data-index="{{idx}}">-</view>
                 <input disabled="true" value="{{item.customGoodsNum}}"/>
                 <input disabled="true" value="{{item.customGoodsNum}}"/>
@@ -26,7 +26,7 @@
         </view>
         </view>
       </view>
       </view>
     </view>
     </view>
-    <view wx:if="{{carList.length === 0}}" class='f-box mar-t20 mar-b20 f-justify-content-center'>暂无数据</view>
+    <data-none wx:if="{{carList.length === 0}}"></data-none>
 </view>
 </view>
 
 
 <view class='footer'>
 <view class='footer'>
@@ -40,4 +40,4 @@
     </view>
     </view>
 </view>
 </view>
   
   
-</view>
+</view>

+ 23 - 8
customized/pages/index/index.wxml

@@ -1,16 +1,31 @@
 <view class="auto">
 <view class="auto">
-  <view class="f-box mar-t20">
-    <view class='cust-img mar-r'>
-        <image src="/customized/images/customized/cup_black_small.png" mode="aspectFit"></image>
-      </view>
-    <view class="f-item mar-l20">
+  <view class="f-box mar-t20 custom-list">
+    <view class='cust-img mar-r20 mar-l20 f-box f-align-items-center'>
+      <image src="/customized/images/customized/cup_black_small.png" mode="aspectFit"></image>
+    </view>
+    <view class="f-item mar-l20 mar-t20 mar-r20">
     <view class='cup-main'>
     <view class='cup-main'>
-     <view class='f-s32'>奶缸-黑色 350ml</view>
-      <view class="mar-t20 f-s32 c-orange">¥45.00</view>
+     <view class='f-s32 mar-t20'>奶缸-黑色 350ml</view>
+      <view class="mar-t20 f-s30 c-orange">¥45.00</view>
+     
+     <view class='f-box mar-t20 f-s32 f-align-items-center'>
+       <navigator bindtap='customized' class='cust-btn f-item f-s32 c-green'>定制</navigator>
+       <view class='tu-icon f-box f-align-items-center'>
+        <image src='/customized/images/customized/tu_icon.png' mode="aspectFit"></image>
+      </view>
+     </view>
+     
     </view>
     </view>
-      <navigator bindtap='customized' class='cust-btn f-s36 bg-green c-white'>去定制</navigator>
+     
     </view>
     </view>
   </view>
   </view>
+
+
+
+
+
+
+
   <view class='cust-footer f-box f-justify-content-end'>
   <view class='cust-footer f-box f-justify-content-end'>
     <navigator open-type="switchTab" url='/pages/index/index' class='icon-shouye iconfont c-green'></navigator>
     <navigator open-type="switchTab" url='/pages/index/index' class='icon-shouye iconfont c-green'></navigator>
     <navigator url='/customized/pages/car/car' class='icon-gouwuche iconfont c-green icon-car'>
     <navigator url='/customized/pages/car/car' class='icon-gouwuche iconfont c-green icon-car'>

+ 16 - 18
customized/pages/index/index.wxss

@@ -1,25 +1,10 @@
 page{
 page{
   background: #fff;
   background: #fff;
 }
 }
-.cust-img{
-  width:240rpx;
-  height:240rpx;
-  background:#eee;
-}
-.cup-main{
-  height:200rpx;
-}
 .cust-img image{
 .cust-img image{
-  width:100%;
-  height: 100%;
-}
-.cust-btn{
-  width:150rpx;
-  height:50rpx;
-  line-height:50rpx;
-  text-align: center;
-  border-radius:50rpx;
-  float: right;
+  width:200rpx;
+  height: 200rpx;
+
 }
 }
 .cust-footer{
 .cust-footer{
   height:100rpx;
   height:100rpx;
@@ -51,4 +36,17 @@ page{
   font-size:22rpx;
   font-size:22rpx;
   right:-12rpx;
   right:-12rpx;
   top:-12rpx;
   top:-12rpx;
+}
+
+.custom-list{
+  width:100%;
+  height:256rpx;
+  background:#fff;
+  border-radius:30rpx;
+  box-shadow: #ddd 1px 1px 10px 5px;
+  overflow: hidden;
+}
+.tu-icon image{
+  width:109rpx;
+  height:35rpx;
 }
 }

+ 10 - 3
project.config.json

@@ -28,7 +28,7 @@
 			"list": []
 			"list": []
 		},
 		},
 		"miniprogram": {
 		"miniprogram": {
-			"current": 9,
+			"current": 10,
 			"list": [
 			"list": [
 				{
 				{
 					"id": 0,
 					"id": 0,
@@ -62,8 +62,8 @@
 				},
 				},
 				{
 				{
 					"id": 5,
 					"id": 5,
-					"name": "order",
-					"pathName": "customized/pages/order/order",
+					"name": "accounts",
+					"pathName": "customized/pages/accounts/accounts",
 					"query": "",
 					"query": "",
 					"scene": null
 					"scene": null
 				},
 				},
@@ -94,6 +94,13 @@
 					"pathName": "customized/pages/address/address",
 					"pathName": "customized/pages/address/address",
 					"query": "",
 					"query": "",
 					"scene": null
 					"scene": null
+				},
+				{
+					"id": -1,
+					"name": "新增地址",
+					"pathName": "customized/pages/address/add/add",
+					"query": "",
+					"scene": null
 				}
 				}
 			]
 			]
 		}
 		}

+ 10 - 0
style/customized.wxss

@@ -84,6 +84,15 @@ page{
 .c-black{
 .c-black{
   color:black;
   color:black;
 }
 }
+.c-666{
+  color:#666;
+}
+.c-999{
+  color:#999
+}
+.c-333{
+  color:#333;
+}
 .bg-orange{
 .bg-orange{
   background:#e8976a;
   background:#e8976a;
 }
 }
@@ -162,4 +171,5 @@ page{
   line-height:100rpx;
   line-height:100rpx;
   background:#fff;
   background:#fff;
   font-size:30rpx;
   font-size:30rpx;
+  z-index:10;
 }
 }