Browse Source

购物车和我的地址

sharp-agezi 6 years ago
parent
commit
c73c9435bd

+ 3 - 2
app.json

@@ -85,7 +85,8 @@
     "pages/authorize/authorize",
     "pages/eachGiftInfor/eachGiftInfor",
     "pages/midAutumnFestival/midAutumnFestival",
-    "components/component-made/made-solid"
+    "components/component-made/made-solid",
+    "components/data-none/data-none"
   ],
   "subpackages": [
     {
@@ -101,7 +102,7 @@
         "pages/car/car",
         "pages/order/order",
         "pages/address/address",
-         "pages/user/user"
+        "pages/user/user"
       ]
     }
   ],

+ 66 - 0
components/data-none/data-none.js

@@ -0,0 +1,66 @@
+// components/data-none/dataNone.js
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload: function () {
+
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh: function () {
+
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom: function () {
+
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage: function () {
+
+  }
+})

+ 3 - 0
components/data-none/data-none.json

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

+ 3 - 0
components/data-none/data-none.wxml

@@ -0,0 +1,3 @@
+<view>
+  <view class='data-none'>暂无数据~</view>
+</view>

+ 6 - 0
components/data-none/data-none.wxss

@@ -0,0 +1,6 @@
+/* components/data-none/dataNone.wxss */
+.data-none{
+  margin:40rpx;
+  font-size:28rpx;
+  text-align: center;
+}

+ 2 - 2
customized/pages/address/address.js

@@ -7,7 +7,7 @@ Page({
    * 页面的初始数据
    */
   data: {
-
+    addressList:[],
   },
 
   /**
@@ -57,7 +57,7 @@ Page({
    */
   getaddress(){
     wx.request({
-      url: host + '/adressview',
+      url: host + '/adressapi/adressview',
       header: {
         'content-type': 'application/x-www-form-urlencoded'
       },

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

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

+ 26 - 1
customized/pages/address/address.wxml

@@ -1 +1,26 @@
-
+<!-- 地址列表 -->
+<view class='address-box'>
+  <view class='address-list bg-white mar-b20'>
+    <view class='mar-l20 mar-r20 pad-t20 pad-b20 f-s28'>
+      <view>王勇 15055166539</view>
+      <view>上海市 上海市 闵行区 虹漕路1467弄</view>
+      <view class='address-icon f-box'>
+        <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" />
+          <text class='icon-font'>默认地址</text>
+        </view>
+        <view>
+          <icon class='icon-bianji iconfont mar-r20' bindtap='edit'/>
+          <icon class='icon-tuanduicankaoxian- iconfont' bindtap='delete'/>
+        </view>
+      
+      </view>
+    </view>
+  </view>
+</view>
+<data-none wx:if="{{addressList.length === 0}}"></data-none>
+<view class='footer'>
+  <view class='footer-box add-address'>
+    <view class='c-white bg-orange f-box f-justify-content-center f-s32' bindtap='addAddress'>新增</view>
+  </view>
+</view>

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

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

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

@@ -160,7 +160,7 @@ Page({
     })
     wx.previewImage({
       urls: urls,
-      current:'e.target.dataset.src',
+      current:e.target.dataset.src,
       success(res){
         console.log(res,"放大成功")
       }

+ 24 - 4
customized/pages/index/index.js

@@ -1,11 +1,14 @@
 // pages/customized/index/index.js
+// customized/pages/made/car/car.js
+let app = getApp();
+let host = app.globalData.servsers; // 请求的url
 Page({
 
   /**
    * 页面的初始数据
    */
   data: {
-
+    carNum:null
   },
 
   /**
@@ -26,7 +29,7 @@ Page({
    * 生命周期函数--监听页面显示
    */
   onShow: function () {
-
+    this.getCarlist(this)
   },
 
   /**
@@ -76,6 +79,23 @@ Page({
         url: "/customized/pages/made/made",
       })
     }
-   
-  }
+  },
+  getCarlist(that) {
+    wx.request({
+      url: host + '/queryShopCar',
+      method: 'post',
+      header: {
+        'content-type': 'application/x-www-form-urlencoded'
+      },
+      data: {
+        userId: app.globalData.user_id   //app.globalData.user_id //'oovpNwjlsY6xx8ceCebFa1dOLd9E'  //app.globalData.user_id,
+      },
+      success: function (res) {
+        console.log('购物车列表数据', res)
+        that.setData({
+          carNum: res.data.length
+        })
+      }
+    })
+  },
 })

+ 3 - 1
customized/pages/index/index.wxml

@@ -13,7 +13,9 @@
   </view>
   <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 url='/customized/pages/car/car' class='icon-gouwuche iconfont c-green'></navigator>
+    <navigator url='/customized/pages/car/car' class='icon-gouwuche iconfont c-green icon-car'>
+      <view class='car-num bg-green c-white' wx:if="{{carNum && carNum !=null}}">{{carNum}}</view>
+    </navigator>
     <navigator url='/customized/pages/user/user' class='icon-wode iconfont c-green'></navigator>
   </view>
 </view>

+ 13 - 0
customized/pages/index/index.wxss

@@ -38,4 +38,17 @@ page{
   text-align: center;
   line-height:70rpx;
   margin-right:30rpx;
+}
+.icon-car{
+  position:relative;
+}
+.car-num{
+  position: absolute;
+  width:40rpx;
+  height:40rpx;
+  line-height:40rpx;
+  border-radius:50%;
+  font-size:22rpx;
+  right:-12rpx;
+  top:-12rpx;
 }

+ 8 - 1
project.config.json

@@ -28,7 +28,7 @@
 			"list": []
 		},
 		"miniprogram": {
-			"current": 8,
+			"current": 9,
 			"list": [
 				{
 					"id": 0,
@@ -87,6 +87,13 @@
 					"pathName": "customized/pages/user/user",
 					"query": "",
 					"scene": null
+				},
+				{
+					"id": -1,
+					"name": "address",
+					"pathName": "customized/pages/address/address",
+					"query": "",
+					"scene": null
 				}
 			]
 		}

+ 16 - 3
style/customized.wxss

@@ -7,9 +7,9 @@
   -moz-osx-font-smoothing: grayscale;
 }
 /* 通用 */
-/* page{
-  background: #fff;
-} */
+page{
+  color: #333;
+}
 .auto{
   margin:0 20rpx;
 }
@@ -122,6 +122,19 @@
   margin-right:20rpx;
 }
 
+.pad-l20{
+  padding-left:20rpx;
+}
+.pad-t20{
+  padding-top:20rpx;
+}
+.pad-b20{
+  padding-bottom:20rpx;
+}
+.pad-r20{
+  padding-right:20rpx;
+}
+
 
 /* 公用样式 */
 .public-prompt{

+ 46 - 0
style/font/demo_index.html

@@ -43,6 +43,12 @@
               </li>
           
             <li class="dib">
+              <span class="icon iconfont">&#xe6b0;</span>
+                <div class="name">编辑</div>
+                <div class="code-name">&amp;#xe6b0;</div>
+              </li>
+          
+            <li class="dib">
               <span class="icon iconfont">&#xe629;</span>
                 <div class="name">首页</div>
                 <div class="code-name">&amp;#xe629;</div>
@@ -79,6 +85,12 @@
               </li>
           
             <li class="dib">
+              <span class="icon iconfont">&#xe640;</span>
+                <div class="name">删除</div>
+                <div class="code-name">&amp;#xe640;</div>
+              </li>
+          
+            <li class="dib">
               <span class="icon iconfont">&#xe644;</span>
                 <div class="name">地址</div>
                 <div class="code-name">&amp;#xe644;</div>
@@ -159,6 +171,15 @@
           </li>
           
           <li class="dib">
+            <span class="icon iconfont icon-bianji"></span>
+            <div class="name">
+              编辑
+            </div>
+            <div class="code-name">.icon-bianji
+            </div>
+          </li>
+          
+          <li class="dib">
             <span class="icon iconfont icon-shouye"></span>
             <div class="name">
               首页
@@ -213,6 +234,15 @@
           </li>
           
           <li class="dib">
+            <span class="icon iconfont icon-tuanduicankaoxian-"></span>
+            <div class="name">
+              删除
+            </div>
+            <div class="code-name">.icon-tuanduicankaoxian-
+            </div>
+          </li>
+          
+          <li class="dib">
             <span class="icon iconfont icon-dizhi"></span>
             <div class="name">
               地址
@@ -277,6 +307,14 @@
           
             <li class="dib">
                 <svg class="icon svg-icon" aria-hidden="true">
+                  <use xlink:href="#icon-bianji"></use>
+                </svg>
+                <div class="name">编辑</div>
+                <div class="code-name">#icon-bianji</div>
+            </li>
+          
+            <li class="dib">
+                <svg class="icon svg-icon" aria-hidden="true">
                   <use xlink:href="#icon-shouye"></use>
                 </svg>
                 <div class="name">首页</div>
@@ -325,6 +363,14 @@
           
             <li class="dib">
                 <svg class="icon svg-icon" aria-hidden="true">
+                  <use xlink:href="#icon-tuanduicankaoxian-"></use>
+                </svg>
+                <div class="name">删除</div>
+                <div class="code-name">#icon-tuanduicankaoxian-</div>
+            </li>
+          
+            <li class="dib">
+                <svg class="icon svg-icon" aria-hidden="true">
                   <use xlink:href="#icon-dizhi"></use>
                 </svg>
                 <div class="name">地址</div>

File diff suppressed because it is too large
+ 14 - 6
style/font/iconfont.css


BIN
style/font/iconfont.eot


File diff suppressed because it is too large
+ 1 - 1
style/font/iconfont.js


File diff suppressed because it is too large
+ 6 - 0
style/font/iconfont.svg


BIN
style/font/iconfont.ttf


BIN
style/font/iconfont.woff


BIN
style/font/iconfont.woff2


File diff suppressed because it is too large
+ 14 - 6
style/iconfont.wxss