wingforgh 1 jaar geleden
bovenliggende
commit
a787a57b09

+ 3 - 1
pages/home/home.js

@@ -58,6 +58,7 @@ Page ({
     showtime: '',
     projects_more:true,
     userinfo:{},
+	info:{},
 	nowseckill_data:'',
 	
 	statusBarHeight:0,//20
@@ -468,7 +469,7 @@ Page ({
   },
   geticons () {
     var that = this
-    var url = 'v1/navigate/icons'
+    var url = 'v1/navigate/icons?source=xcx'
     var params = {}
     var success = function (res) {
       var icons = res.data
@@ -637,6 +638,7 @@ Page ({
     var params = {}
     var success = function (res) {
       that.setData({
+		info:res.data,
       	userinfo:res.data.wx_user,
         showpyq: res.data.wx_user.show_invite_mode
       })

+ 9 - 3
pages/home/home.wxml

@@ -27,10 +27,16 @@
     <view class="selectitem">
         <!--<navigator url="{{item.url}}" hover-class="none" open-type="switchTab" wx:if="{{}}">
         </navigator>-->
-        <view wx:key="{{index}}" bindtap="toviewfunc" data-val="{{item}}" wx:for="{{iconslist}}" class="item-box">
-          <image src="{{item.cover}}" class="item-index" />
-          <view class="item-name"><!-- <i wx:if="{{!item.use_quan}}" style="display: inline-block;background: #F44336;color: #fff;padding: 0px 5px;font-size: 11px;line-height: 35rpx;margin-right: 10rpx;vertical-align: middle;">特惠</i> -->{{item.name}}</view>
+        <view wx:key="{{index}}" bindtap="toviewfunc" data-val="{{item}}" wx:for="{{iconslist}}" wx:if="{{item.id != 19}}" class="item-box">
+		  <image src="{{item.cover}}" class="item-index" />
+		  <view class="item-name"><!-- <i wx:if="{{!item.use_quan}}" style="display: inline-block;background: #F44336;color: #fff;padding: 0px 5px;font-size: 11px;line-height: 35rpx;margin-right: 10rpx;vertical-align: middle;">特惠</i> -->{{item.name}}</view>
         </view>
+		
+		<!-- 员工专区 -->
+		<view wx:key="{{index}}" bindtap="toviewfunc" data-val="{{item}}" wx:for="{{iconslist}}" wx:if="{{item.id == 19 && info['user']['employ']}}" class="item-box">
+		  <image src="{{item.cover}}" class="item-index" />
+		  <view class="item-name"><!-- <i wx:if="{{!item.use_quan}}" style="display: inline-block;background: #F44336;color: #fff;padding: 0px 5px;font-size: 11px;line-height: 35rpx;margin-right: 10rpx;vertical-align: middle;">特惠</i> -->{{item.name}}</view>
+		</view>
       <!-- <view bindtap="tocentcart" class="item-box">
         <image src="http://fohow.oss-cn-shenzhen.aliyuncs.com/navigation_icons/cent.png" class="item-index" />
         <view class="item-name">积分专区</view>

+ 42 - 4
pages/pay/pay.js

@@ -33,6 +33,7 @@ Page({
 	_yunfei:0,
     payFlag:false,
     useBalance:false,
+	useCash:true,
     afterdec:0,//使用提货券扣除后的总额
 	remark:'',
 	
@@ -46,7 +47,10 @@ Page({
 	use_silver:0,
 	pay_cash:0,//佣金抵扣
 	freight_limit:9900,
-	unquan_silver:0//不能使用提货券抵扣的银豆
+	unquan_silver:0,//不能使用提货券抵扣的银豆
+	
+	//20240314使用新接口获取相关扣除
+	payQueryData:{}
   },
   onLoad: function (options) {
     this.data.orderId = options.orderId;
@@ -204,6 +208,8 @@ Page({
 		  }
 	  }
 	  
+	  that.getPayQuery();
+	  
 	  
     }
     __request.$get(url, params, success)
@@ -376,6 +382,7 @@ Page({
 		}
 		console.log('minus_cash',minus_cash);
 		
+		
       that.setData({
         balanceInfo: val.data,
         cache: false,
@@ -390,9 +397,12 @@ Page({
 		discountBl: val.data.discount_bl,
 		sourceAfterdec: source_afterdec,
 		pay_cash: minus_cash,
-		freight_limit:val.data.freight_limit
+		freight_limit:val.data.freight_limit,
 		// disAmount:dis_amount
       });
+	  
+		console.log('useBalance',that.data.useBalance);
+		console.log('coupon_price',that.data.coupon_price);
     }
     __request.$get(url, params, success)
   },
@@ -418,6 +428,14 @@ Page({
 	that.setData({
 		useBalance:e.detail.value
 	})
+	that.getPayQuery();
+  },
+  switchcashChange:function(e){
+  	var that = this;
+  	that.setData({
+  		useCash:e.detail.value
+  	})
+	that.getPayQuery();
   },
   getUserInfo: function () {
     var that = this
@@ -605,7 +623,8 @@ Page({
 		  address_id: that.data.address.id,
 		  s: 'xcx',
 		  use_coupon:that.data.useBalance,
-		  remark:that.data.remark
+		  remark:that.data.remark,
+		  use_balance:that.data.useCash
 		}
 	}else{
 		params = {
@@ -615,6 +634,7 @@ Page({
 		  pay_way: that.data.curPayway,
 		  s: 'xcx',
 		  use_coupon:that.data.useBalance,
+		  use_balance:that.data.useCash,
 		  remark:that.data.remark,
 		  pick_dept:that.data.pickid,
 		  pick_addr_id:that.data.pick_address.id
@@ -717,7 +737,8 @@ Page({
 		  		yunfei : e.target.dataset.value == 0 ? this.data._yunfei : 0
 		  })
 		  wx.setStorageSync('receivetype', e.target.dataset.value) //存入
-		  this.getBalanceInfo()
+		  this.getBalanceInfo();
+		  this.getPayQuery();
 	  }else{
 		  wx.showToast({
 		    title: '当前提货方式已确定',
@@ -793,5 +814,22 @@ Page({
    	   })
      }
      __request.$get(url, params, success)
+   },
+   //获取扣减相关
+   getPayQuery() {
+     var that = this
+     var url = 'v1/pay/query'
+     var params = {
+		'order_id':that.data.orderId,
+		'use_coupon':true, //是否使用提货券
+		'use_balance':that.data.useCash, //是否使用佣金
+		'pick_way':that.data.receivetype, //自提方式
+     }
+     var success = function (res) {
+		that.setData({
+		  payQueryData:res.data
+		})
+     }
+     __request.$post(url, params, success)
    }
 })

+ 23 - 20
pages/pay/pay.wxml

@@ -179,10 +179,10 @@
 	      <text >佣金抵扣 (剩余:{{cashInfo.available / 100}})</text>
 	    </view>
 	    <view class="fr pay-balance-cash" wx:if="{{!payData.shut_wechat}}">
-			<text class="pay-circle">
+			<!-- <text class="pay-circle">
 			  <text class="pay-select"></text>
-			</text>
-	      <!-- <switch checked bindchange="switchChange" color="#eab86a" style="zoom:0.75"/> -->
+			</text> -->
+	      <switch checked bindchange="switchcashChange" color="#eab86a" style="zoom:0.75"/>
 	    </view>
 		<view class="fr pay-balance-cash" wx:else>
 		  <text class="pay-circle">
@@ -270,14 +270,14 @@
 	  	订单总金额 <text style="color:#F00">{{receivetype == 0 ? ((payData.total_price + payData.freight) / 100) : (payData.total_price / 100)}}</text>
 	  </view>
 	  
-	  <view wx:if="{{payData.paied_silver>0 || useSeilver>0}}">
-		  <view wx:if="{{payData.pay_way == ''}}" style="padding:15rpx;text-align:right">
-		  	使用银豆抵扣 <text style="color:#F00">-{{useSeilver / 100}}</text>
+	  <!-- <view wx:if="{{payData.paied_silver>0 || useSeilver>0}}"> -->
+		  <view wx:if="{{payQueryData && payQueryData['FirstPay']}}" style="padding:15rpx;text-align:right">
+		  	使用银豆抵扣 <text style="color:#F00">-{{payQueryData['PaySilver'] / 100}}</text>
 		  </view>
-		  <view wx:if="{{payData.pay_way != ''}}" style="padding:15rpx;text-align:right">
+		  <view wx:if="{{payQueryData && !payQueryData['FirstPay']}}" style="padding:15rpx;text-align:right">
 		  	使用银豆抵扣 <text style="color:#F00">-{{payData.paied_silver / 100}}</text>
 		  </view>
-	  </view>
+	  <!-- </view> -->
 	  
 	  
 	  
@@ -287,24 +287,24 @@
 		<text style="color:#F00" wx:else>-{{disAmount / 100}}</text>
 	  </view>
 	  
-	  <view wx:if="{{payData.coupon_price>0 || ((minusTotal+yunfei)-afterdec)>0}}">
-		<view wx:if="{{useBalance && payData.pay_way == ''}}" style="padding:15rpx;text-align:right">
-			使用提货券抵扣 <text style="color:#F00">-{{payData.coupon_price>0?payData.coupon_price/100:((minusTotal+yunfei)-afterdec) / 100}}</text> 提货券
+	  <!-- <view wx:if="{{payData.coupon_price>0 || ((minusTotal+yunfei)-afterdec)>0}}"> -->
+		<view wx:if="{{useBalance && payQueryData && payQueryData['FirstPay']}}" style="padding:15rpx;text-align:right">
+			使用提货券抵扣 <text style="color:#F00">-{{payQueryData['PayCoupon'] / 100}}</text> 提货券
 		</view>
-		<view wx:if="{{payData.pay_way != ''}}" style="padding:15rpx;text-align:right">
+		<view wx:if="{{payQueryData && !payQueryData['FirstPay']}}" style="padding:15rpx;text-align:right">
 			使用提货券抵扣 <text style="color:#F00">-{{payData.coupon_price/100}}</text> 提货券
 		</view>
-	  </view>
+	  <!-- </view> -->
 	  
 	  
-	  <view wx:if="{{payData.paied_cash>0 || pay_cash>0}}">
-		  <view wx:if="{{payData.pay_way == ''}}" style="padding:15rpx;text-align:right">
-			使用佣金抵扣 <text style="color:#F00">-{{payData.paied_cash>0?payData.paied_cash/100:pay_cash / 100}}</text> 佣金
+	  <!-- <view wx:if="{{payData.paied_cash>0 || pay_cash>0}}"> -->
+		  <view wx:if="{{payQueryData && payQueryData['FirstPay'] && useCash}}" style="padding:15rpx;text-align:right">
+			使用佣金抵扣 <text style="color:#F00">-{{payQueryData['PayBalance'] / 100}}</text> 佣金
 		  </view>
-		  <view wx:if="{{payData.pay_way != ''}}" style="padding:15rpx;text-align:right">
+		  <view wx:if="{{payQueryData && !payQueryData['FirstPay']}}" style="padding:15rpx;text-align:right">
 			使用佣金抵扣 <text style="color:#F00">-{{payData.paied_cash/100}}</text> 佣金
 		  </view>
-	  </view>
+	  <!-- </view> -->
 	  
 	  
     </view>
@@ -330,10 +330,13 @@
         	<text class="red">{{(minusTotal+yunfei) / 100}}积分</text>
         </view>
         <view wx:else style="display: inline;">
-        	<currency wx:if="{{useBalance}}" symbol="¥" value="{{afterdec - (payData.dis_amount>0?payData.dis_amount: disAmount) - (payData.paied_cash>0?payData.paied_cash: pay_cash)}}" class="red"></currency>
+        	<currency wx:if="{{payQueryData && payQueryData['FirstPay']}}" symbol="¥" value="{{payQueryData['ShouldPay']}}" class="red"></currency>
 	        <!-- <currency wx:else symbol="¥" value="{{payData.pay_way == '' ? total+yunfei : payData.paied_price}}" class="red"></currency> -->
-	        <currency wx:else symbol="¥" value="{{payData.pay_way == '' ? minusTotal+yunfei : minusTotal+yunfei-payData.coupon_price-payData.paied_cash}}" class="red"></currency>
+	        <currency wx:else symbol="¥" value="{{minusTotal+yunfei-(payData.dis_amount>0?payData.dis_amount: disAmount) - payData.coupon_price-payData.paied_cash}}" class="red"></currency>
 	        
+			
+			
+			
 	        <text class="red" wx:if="{{curPayway === 'balance'}}">{{(minusTotal+yunfei) / 100}}<currency value="{{minusTotal}}" class="red"></currency>提货券</text>
 	        <text class="red" wx:if="{{curPayway === 'integral'}}">{{(minusTotal+yunfei) / 100}}提货券</text>
         </view>

+ 55 - 17
pages/projects/project-detail/project-detail.js

@@ -76,6 +76,9 @@ Page({
 	this.setData({
 	  readOnly: options.read ? options.read : 0
 	})
+	if(options.read != 0){
+		wx.hideShareMenu();
+	}
     this.getBalanceInfo()
   },
   onShow: function () {
@@ -342,12 +345,26 @@ Page({
     _request.$get(url, params, success, fail)
   },
   add: function () {
-    if (this.data.count < this.data.project.left_count) {
-      var count = this.data.count + 1
-      this.setData({
-        count: count
-      })
-    }
+	  if(this.data.project.package){
+		  var count = this.data.count + 1
+		  this.setData({
+		    count: count
+		  })
+	  }else{
+		  if (this.data.count < this.data.project.left_count) {
+		    var count = this.data.count + 1
+		    this.setData({
+		      count: count
+		    })
+		  }else{
+		  	wx.showToast({
+		  	  title: '已达到商品库存上限',
+		  	  icon: 'none',
+		  	  duration: 1000
+		  	})
+		  }
+	  }
+    
   },
   mius: function () {
     if (this.data.count > 1) {
@@ -355,15 +372,31 @@ Page({
       this.setData({
         count: count
       })
-    }
+    }else{
+		wx.showToast({
+		  title: '不可以小于1',
+		  icon: 'none',
+		  duration: 1000
+		})
+	}
   },
   changeCount: function (val) {
     var count = val.detail.value
     if (count <= 0) {
+		wx.showToast({
+		  title: '不可以小于1',
+		  icon: 'none',
+		  duration: 1000
+		})
       this.setData({
         count: 1
       })
-    } else if (count > this.data.project.left_count) {
+    } else if (!this.data.project.package && count > this.data.project.left_count) {
+		wx.showToast({
+		  title: '已达到商品库存上限',
+		  icon: 'none',
+		  duration: 1000
+		})
       this.setData({
         count: this.data.project.left_count
       })
@@ -506,15 +539,20 @@ Page({
         })
       }
     }
-    if (that.data.count <= that.data.project.left_count) {
-      _request.$post(url, params, success)
-    } else {
-      wx.showToast({
-        title: '库存不足~',
-        icon: 'none',
-        duration: 2000
-      })
-    }
+	if(this.data.project.package){
+		_request.$post(url, params, success)
+	}else{
+		if (that.data.count <= that.data.project.left_count) {
+		  _request.$post(url, params, success)
+		} else {
+		  wx.showToast({
+		    title: '库存不足~',
+		    icon: 'none',
+		    duration: 2000
+		  })
+		}
+	}
+    
   },
   addCart:function(){
   	var that = this;

+ 4 - 4
pages/projects/project-detail/project-detail.wxml

@@ -24,7 +24,7 @@
 		</view>
 		
 		
-		<button open-type="share" class="toolBox-item" wx:if="{{readOnly != 1}}">
+		<button open-type="share" class="toolBox-item" wx:if="{{readOnly == 0}}">
 			<image src="../../../images/footer/wx.png" />
 		</button>
 		<button class="toolBox-item" bindtap="toTop" wx:if="{{backTopValue}}"><image src="../../../images/footer/totop.png" /></button>
@@ -59,7 +59,7 @@
     </view>
     
     <h3 class="detail-width detail-title"><i style="display: inline-block;background: #F44336;color: #fff;padding: 0px 5px;font-size: 11px;line-height: 35rpx;margin-right: 10rpx;vertical-align: middle;">{{project.sale_zone_name}}</i>{{project.name}}</h3>
-    <button bindtap="sharetips" class="sharebtn" wx:if="{{readOnly != 1}}"><image src="../../../images/footer/pyq.png" /><text>分享到朋友圈</text></button>
+    <button bindtap="sharetips" class="sharebtn" wx:if="{{readOnly == 0}}"><image src="../../../images/footer/pyq.png" /><text>分享到朋友圈</text></button>
     <!--<view class="detail-width">
       <text class="detail-normal detail-mr">价格</text>
       <currency symbol="¥" value="{{project.price}}" class="detail-price"></currency>
@@ -169,7 +169,7 @@
   </view>
 
 
-  <view class="detail-footer" wx:if="{{readOnly == 0}}">
+  <view class="detail-footer" wx:if="{{readOnly == 0 || readOnly == 2}}">
     <view class="detail-footer-bar" style="padding-bottom: {{value}}rpx;">
       <view class="detail-footer-item" style="flex: 0.18;">
         <navigator url="../../home/home" open-type="switchTab">
@@ -192,7 +192,7 @@
         </navigator>
       </view>
       -->
-      <view class="detail-footer-item" style="flex: 0.18;" bindtap="createPoster">
+      <view class="detail-footer-item" style="flex: 0.18;" bindtap="createPoster" wx:if="{{readOnly == 0}}">
         <image src="../../../images/footer/poster.png" class="p-footer-icon"></image>
         <text class="p-footer-text">分享</text>
       </view>

+ 65 - 13
pages/projects/projects.js

@@ -25,15 +25,17 @@ Page({
 	selectData: [],//下拉列表的数据
 	index: 0,//选择的下拉列表下标
 	zones:[],
-	currentZones:0
+	currentZones:0,
+	info:{}
   },
   onLoad: function (options) {
+	  console.log('options',options);
 	  const info = wx.getSystemInfoSync();
 	  console.log('info',info);
 	  this.setData({
 	  		statusBarHeight:info.statusBarHeight
 	  })
-	  
+	  this.info()
 	  this.getData()
     this.getBalanceInfo()
     this.setData({
@@ -52,6 +54,7 @@ Page({
         })
       }
     })
+	
   },
   onShow: function () {
     if (getApp().globalData.isshow) {
@@ -114,7 +117,18 @@ Page({
     var success = function (res) {
       that.setData({
         navData: res.data
-      })
+      });
+	  
+	  
+	  let currentid = that.data.navData[that.data.currentTab]['id'];
+	  console.log('currentid',currentid);
+	  
+	  if(currentid == 25){
+	  	wx.hideShareMenu();
+	  }else{
+	  	wx.showShareMenu();
+	  }
+	  
 	  that.getZones()
       that.getProjects()
     }
@@ -132,7 +146,9 @@ Page({
 	  _request.$get(url, params, success)
   },
   getProjects: function () {
-    var id = this.data.navData[this.data.currentTab].id
+	  console.log('this.data.navData',this.data.navData);
+	  console.log('this.data.currentTab',this.data.currentTab);
+    var id = this.data.navData[this.data.currentTab]['id'];
     if (!this.data.vershow) {
       id = 3
     }
@@ -178,10 +194,21 @@ Page({
     _request.$get(url, params, success)
   },
   toProject: function (val) {
-    var id = val.currentTarget.dataset.val
-    wx.navigateTo({
-      url: '/pages/projects/project-detail/project-detail?id=' + id
-    })
+    var id = val.currentTarget.dataset.val;
+	
+	let currentid = this.data.navData[this.data.currentTab]['id'];
+	console.log('currentid',currentid);
+	
+	if(currentid == 25){
+		wx.navigateTo({
+		  url: '/pages/projects/project-detail/project-detail?id=' + id+'&read=2'
+		})
+	}else{
+		wx.navigateTo({
+		  url: '/pages/projects/project-detail/project-detail?id=' + id
+		})
+	}
+    
   },
   switchNav(event){
     var cur = event.currentTarget.dataset.current
@@ -215,10 +242,15 @@ Page({
     _request.$get(url, params, success)
   },
   onShareAppMessage: function (val) {
-    return _request.share({
-      // path: '/pages/start/start?url=pages/projects/projects',
-      sc: 'xcx_products'
-    })
+	if(read == 0){
+		return _request.share({
+		  // path: '/pages/start/start?url=pages/projects/projects',
+		  sc: 'xcx_products'
+		})
+	}else{
+		return {};
+	}
+    
   },
   tosearch: function (val) {
     var id = val.currentTarget.dataset.val;
@@ -286,6 +318,15 @@ Page({
 			currentZones: 0
 		  })
 		  this.getProjects()
+		  
+		  let currentid = this.data.navData[cur]['id'];
+		  console.log('currentid',currentid);
+		  
+		  if(currentid == 25){
+		  	wx.hideShareMenu();
+		  }else{
+		  	wx.showShareMenu();
+		  }
 		}
     },
 	closeselect(){
@@ -307,5 +348,16 @@ Page({
 		  })
 		  this.getProjects()
 		}
-	}
+	},
+	info(){
+	  var that = this
+	  var url = 'v1/user/info'
+	  var params = {}
+	  var success = function (res) {
+	    that.setData({
+			info:res.data,
+	    })
+	  }
+	  _request.$get(url, params, success)
+	},
 })

+ 3 - 1
pages/projects/projects.wxml

@@ -27,7 +27,9 @@
 								<image src="../../images/footer/selectdown.png" style="margin-left: 15rpx;"/>
 						    </view>
 						    <view class='option_box' style='height:{{selectShow?navData.length*58:0}}rpx;top:{{statusBarHeight + 85}}px;'>
-						        <text class="option  {{currentTab == idx ?'active':''}}" wx:for='{{navData}}'  wx:for-index="idx" wx:for-item="navItem" wx:key='this' data-index='{{idx}}' data-current="{{idx}}" catchtap='optionTap'>{{navItem.name}}</text>
+						        <text class="option  {{currentTab == idx ?'active':''}}" wx:for='{{navData}}'  wx:for-index="idx" wx:for-item="navItem" wx:key='this' data-index='{{idx}}' data-current="{{idx}}" catchtap='optionTap' wx:if="{{navItem.id != 25}}">{{navItem.name}}</text>
+								<!-- 员工专区 -->
+								<text class="option  {{currentTab == idx ?'active':''}}" wx:for='{{navData}}'  wx:for-index="idx" wx:for-item="navItem" wx:key='this' data-index='{{idx}}' data-current="{{idx}}" catchtap='optionTap' wx:if="{{navItem.id == 25 && info['user']['employ']}}">{{navItem.name}}</text>
 						    </view>
 						</view>
 					</view>

+ 6 - 6
utils/request.js

@@ -1,14 +1,14 @@
-// 新正式(未审批)
-const apiHost = 'https://fohowapi.hiwavo.com/';
-const apiHostX = 'https://xj.hiwavo.com/';//正式
+// 新正式(未审批)不用了
+// const apiHost = 'https://fohowapi.hiwavo.com/';
+// const apiHostX = 'https://xj.hiwavo.com/';//正式
 
-// 新正式(未审批)
+// 新正式
 // const apiHost = 'https://xcx-api.fohowyc.com/';
 // const apiHostX = 'https://app-api.fohowyc.com/';//正式
 
 // 测试
-// const apiHost = 'https://tfohowapi.hiwavo.com/';
-// const apiHostX = 'https://txj.hiwavo.com/';
+const apiHost = 'https://tfohowapi.hiwavo.com/';
+const apiHostX = 'https://txj.hiwavo.com/';