Ver código fonte

新需求的添加

wangyong 6 anos atrás
pai
commit
4efa2a936f

+ 38 - 2
pages/buy/buy.js

@@ -134,6 +134,8 @@ Page({
     cartNum: 0,//footer购物车显示的数量
     minNumber: 0,//购买数量
     commodityChannelPrice:null, //渠道价格
+    channelName:null,
+    _carTotal:null,// 购物车全部数量
 
   },
 
@@ -873,6 +875,10 @@ Page({
 
       }
     })
+    that.getCarNum(that)
+    that.setData({
+      channelName: wx.getStorageSync('channelName')
+    })
     that.loadFun();
     if (wx.getStorageSync('channelIdObj').channelId) {
       that.setData({
@@ -880,8 +886,35 @@ Page({
       })
     }
   },
-
-
+  // 获取购物车数量
+  getCarNum(that){
+    console.log("开始执行")
+    let un_id = getApp().globalData.un_id,
+     host = getApp().globalData.servsers,
+    data = {
+      user_id: un_id,
+      channel_account_id: wx.getStorageSync('channelIdObj').channelAccountId ? wx.getStorageSync('channelIdObj').channelAccountId : "",
+      channel_id: wx.getStorageSync('channelIdObj').channelId ? wx.getStorageSync('channelIdObj').channelId : ""
+    }
+    wx.request({
+      url: host + "/shoppingcartapi/shoppingcartview",
+      data: data,
+      method: 'GET', // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT
+      header: {
+        'Accept': 'application/json'
+      },
+      success: function (res) {
+        if (res == null || res.data == null) {
+          console.error('网络请求失败');
+          return;
+        } else {
+          that.setData({
+            _carTotal: res.data.total
+          })
+        }
+      }
+    });
+  },
   //获得对象的key
   getObjKeys: function (obj) {
     var that = this;
@@ -2225,6 +2258,8 @@ Page({
             if (res == null || res.data == null) {
               console.error('网络请求失败');
               return;
+            } else {
+              that.getCarNum(that)
             }
           }
         })
@@ -2525,6 +2560,7 @@ Page({
         animationDataSer: animation.export()
       })
     }.bind(this), 200)
+ 
 
   },
 

+ 2 - 1
pages/buy/buy.wxml

@@ -46,6 +46,7 @@
           <!-- <text class="old_price"  decode="true" >&nbsp;¥{{oldPrice}}&nbsp;&nbsp;</text> -->
           
         </view>
+        <view class='momo' wx:if="{{channelName}}">{{channelName}}</view>
         <view class="goods_limit  clearfix">
           <view class='goods_limit_each'>
             <text class='goods_limit_each_tit'>起订</text>
@@ -107,7 +108,7 @@
     
     <view   bindtap='linkCart' class="footer_left_each  footer_left_cart">
       <icon class='iconfont icon-gouwuche'></icon>
-      <view>购物车<text class='car-num' wx:if="{{cartNum != 0}}">{{cartNum}}</text></view>
+      <view>购物车<text class='car-num' style='width:{{_carTotal && _carTotal >= 100 ? "46rpx" : "40rpx"}}' wx:if="{{_carTotal && _carTotal != 0 }}">{{_carTotal >= 100 ? '99+':_carTotal}}</text></view>
       <!-- <view  wx:if="{{cartNum != 0}}"  class="cart_num">
         <image  src='/images/buy_cart_num.png'  class="cart_num_icon"></image>
         <view class='cart_num_num c-white' >{{cartNum}}</view>

+ 15 - 3
pages/buy/buy.wxss

@@ -347,14 +347,15 @@ button.share_wrap .collect_icon{
 .footer_left_each .car-num{
   background:#ed4451;
   color:#fff;
-  width:40rpx;
   height:40rpx;
   text-align: center;
   line-height:40rpx;
-  border-radius:50%;
+  border-radius:40rpx;
   position: absolute;
   top:0;
-  right:20rpx;
+  right:12rpx;
+  min-width:40rpx;
+  width:auto;
 }
 .navigator-hover{
   background-color:rgba(35,35,35,0);
@@ -857,4 +858,15 @@ contact-button {
 }
 .channel-price{
   font-size:50rpx;
+}
+.momo{
+  color:#ed4451;
+  font-size:25rpx;
+  background:#fff1f1;
+  text-align: center;
+  line-height:38rpx;
+  height:38rpx;
+  margin-bottom:40rpx;
+  display:inline-block;
+  padding:0 10rpx;
 }

+ 0 - 6
pages/mine/mine.js

@@ -121,12 +121,6 @@ Page({
     var openid = getApp().globalData.openid;
     var userInfo = getApp().globalData.userInfo;
     var userRole = getApp().globalData.userRole;
-
-    // if ((un_id == undefined || un_id == '' || un_id == null) || (openid == undefined || openid == '' || openid == null)) {
-    //   wx.navigateTo({
-    //     url: '/pages/authorize/authorize?link=mine',
-    //   })
-    // } else {
     that.getPhone(that)
     userInfo = getApp().globalData.userInfo;
       

+ 19 - 2
pages/orderCanvas/orderCanavs.js

@@ -10,7 +10,8 @@ Page({
     orderImg:null,
     host:host,
     params:null,
-    uploadText:"上传付款凭证"
+    uploadText:"上传付款凭证",
+    orderList:[],
   },
 
   /**
@@ -35,7 +36,8 @@ Page({
    */
   onShow: function () {
     let that = this;
-    that.getImg(that)
+    that.getOrderList(that)
+    // that.getImg(that)
   },
 
   /**
@@ -119,6 +121,21 @@ Page({
     })
 
   },
+  getOrderList(that){
+    wx.request({
+      url: host +'/orderapi/orderView',
+      data:{
+        order_number: that.data.params.orderId
+      },
+      method:'get',
+      success(res){
+        console.log(res)
+        that.setData({
+          orderList: res.data[0].list_order_aff_data
+        })
+      }
+    })
+  },
   getImg(that){
     wx.request({
       url: host+'/orderapi/getOrderShareById',

+ 20 - 1
pages/orderCanvas/orderCanavs.wxml

@@ -1,6 +1,25 @@
 
 <view>
- <image src='{{host}}{{orderImg}}' class='order-img' mode='widthFix'></image>
+ <block wx:for="{{orderList}}" wx:key="index"  wx:for-index="{{i}}"> 
+  <view class="goods_infor">
+    <view class="each_goods">
+      <image src="{{item.logo}}" class="goods_img" mode='aspectFit'></image>
+      <view class="goods_cont">
+
+        <view class="goods_price">¥<text>{{item.com_price}}</text></view>
+        <view class="goods_name">{{item.com_name}}</view>
+        <view class="goods_style"> 
+          <text wx:if="{{item.com_style1}}">{{item.com_style1}} </text>
+          <text wx:if="{{item.com_style2}}">{{item.com_style2}} </text>
+          <text wx:if="{{item.com_style3}}">{{item.com_style3}} </text>
+          <text wx:if="{{item.com_style4}}">{{item.com_style4}} </text>
+          <text wx:if="{{item.com_style5}}">{{item.com_style5}} </text>
+        </view>
+        <view class="goods_num">x{{item.com_num}}</view>
+      </view>
+    </view> 
+  </view>
+ </block> 
 </view>
 <view class='footer'>
   <view class='footer-box'>

+ 2 - 2
pages/orderCanvas/orderCanavs.wxss

@@ -18,13 +18,13 @@ page{
 }
 .each_goods{
   min-height: 212rpx;
-  margin-bottom:14rpx;
+  margin-bottom:3rpx;
 }
 .goods_img{
   float: left;
   display: block;
   width: 214rpx;
-  height: 234rpx;
+  height: 214rpx;
 }
 .goods_cont{
   float: left;

+ 1 - 1
pages/orderList/orderList.wxml

@@ -38,7 +38,7 @@
       <!-- 价格与按钮 -->
       <view class="f-box f-justify-content-center order-btn">
         <view class='f-item f-box f-justify-content-end mar-r26'>
-          <view class='btn' wx:if="{{item.order_sta ==1 || item.order_sta ==2}}" data-index="{{index}}" data-orderId="{{item.order_number}}" bindtap='uploadImg'>{{item.list_order_aff_data[0].pay_order ? "修改凭证" :"上传凭证"}}</view>
+          <view class='btn' wx:if="{{item.order_sta ==1}}" data-index="{{index}}" data-orderId="{{item.order_number}}" bindtap='uploadImg'>{{item.list_order_aff_data[0].pay_order ? "修改凭证" :"上传凭证"}}</view>
           <!-- <view class='btn' wx:if="{{item.order_sta ==4}}">查看物流</view> -->
           <view class='btn' wx:if="{{item.order_sta ==4}}" data-index="{{index}}" data-orderId="{{item.order_number}}" bindtap='uploadImg' >{{item.list_order_aff_data[0].final_payment ? "修改尾款单凭证" :"上传尾款单凭证"}}</view>
         </view>