junyuanz 3 år sedan
förälder
incheckning
8ffadc2de2

+ 44 - 7
pages/cart/cart.js

@@ -15,7 +15,8 @@ Page({
     submitlock:false,
     x:0,
     currentX: 0,
-	seckillruntimearr:[]
+	seckillruntimearr:[],
+	localCartList:{}
   },
   handleMovableChange: function(e) {
     // this.data.currentX = e.detail.x;
@@ -65,15 +66,30 @@ Page({
       console.log(res)
     	if(res.data.list){
 			var skrt = that.data.seckillruntimearr;
+			
+			var localcl = wx.getStorageSync('localCartList') ? wx.getStorageSync('localCartList') : res.data.list;
+			console.log('localcl',localcl);
     		for(let i in res.data.list){
     			res.data.list['movex'] = 0;
 				skrt.push('');
+				
+				
+				for(let o in localcl){
+					if(res.data.list[i]['id'] == localcl[o]['id']){
+						// if(res.data.list[i]['count'] < localcl[o]['count']){
+							res.data.list[i]['count'] = localcl[o]['count'];
+						// }else{
+							// localcl[o]['count'] = res.data.list[i]['count'];
+						// }
+					}
+				}
     		}
     		that.setData({
 	        cartList: res.data.list,
 	        cartCount: res.data.count,
 	        cartTotal: res.data.total,
-			seckillruntimearr:skrt
+			seckillruntimearr:skrt,
+			localCartList: localcl
 	      })
 		  
 		  that.seckilltime();
@@ -95,10 +111,25 @@ Page({
     var success = function (res) {
       console.log(res)
     	if(res.data.list){
+			var localcl = wx.getStorageSync('localCartList') ? wx.getStorageSync('localCartList') : res.data.list;
+			console.log('localcl',localcl);
+			for(let i in res.data.list){
+				for(let o in localcl){
+					if(res.data.list[i]['id'] == localcl[o]['id']){
+						// if(res.data.list[i]['count'] < localcl[o]['count']){
+							res.data.list[i]['count'] = localcl[o]['count'];
+						// }else{
+							// localcl[o]['count'] = res.data.list[i]['count'];
+						// }
+					}
+				}
+			}
+			
     		that.setData({
 	        cartList: res.data.list,
 	        cartCount: res.data.count,
-	        cartTotal: res.data.total
+	        cartTotal: res.data.total,
+			localCartList: localcl
 	      })
     		that.allSelect();
     	}else{
@@ -112,7 +143,8 @@ Page({
     _request.$get(url, params, success)
   },
   add: function (e) {
-  	console.log('tapadd',e)
+  	console.log('tapadd',e);
+	var that = this;
   	var itemid = e.currentTarget.dataset.id;
   	var itemcount = e.currentTarget.dataset.count;
   	console.log('itemcount',itemcount)
@@ -120,7 +152,8 @@ Page({
     	var index = e.currentTarget.dataset.index;
       var count = itemcount + 1;
       this.setData({
-	      ['cartList[' + index + '].count']:count 
+	      ['cartList[' + index + '].count']:count,
+		  localCartList:that.data.cartList
 	    })
       this.checkSelected();
 //    this.changeServercount(count,itemid);
@@ -135,7 +168,8 @@ Page({
       var count = itemcount - 1;
       var index = e.currentTarget.dataset.index;
       this.setData({
-	      ['cartList[' + index + '].count']:count 
+	      ['cartList[' + index + '].count']:count,
+		  localCartList:that.data.cartList
 	    })
       this.checkSelected();
 //    this.changeServercount(count,itemid);
@@ -310,11 +344,14 @@ Page({
   	checkitemnum = checkitemnum.substr(0,checkitemnum.length - 1);
   	
   	
+  	//setlocalcartlist
+	wx.setStorageSync('localCartList',cartList);
+	
   	this.setData({
 		  checkeditems:checkitem,
 		  checkeditemsnum:checkitemnum,
 		  cartCount: checkcount,
-    	cartTotal: checktotal
+		  cartTotal: checktotal
 		})
 //		this.mulChangeState();
   },

+ 1 - 1
pages/home/home.wxss

@@ -423,7 +423,7 @@
 }
 .item-box{
 	text-align: center;
-	width: 20%;
+	width: 25%;
 	margin-bottom: 25rpx;
 }
 .selectitem-index {

+ 21 - 0
pages/projects/project-detail/project-detail.js

@@ -204,8 +204,15 @@ Page({
     var params = {}
     var success = function (val) {
       var p = val.data.detail
+	  let cbox = [];
+	for(let i in val.data){
+		if(i != 'product' && val.data[i]) cbox.push(i);
+	}
+	console.log('cbox',cbox);
       that.setData({
         project: val.data,
+		productSize: val.data,
+		 checkbox:cbox,
         clock: val.data.seckill_end
       });
       WxParse.wxParse('parse', 'html', p, that, 10)
@@ -504,6 +511,20 @@ Page({
     var params = {}
     var success = function (res) {
     	if(res.data.result){
+			//添加购物车后,更新本地数量
+			var localcl = wx.getStorageSync('localCartList') ? wx.getStorageSync('localCartList') : [];
+			if(localcl.length > 0){
+				for(let i in localcl){
+					if(localcl[i]['product_id'] == that.data.productId){
+						localcl[i]['count'] = localcl[i]['count'] + that.data.count;
+					}
+				}
+				
+				//setlocalcartlist
+				wx.setStorageSync('localCartList',localcl);
+			}
+			console.log('localcl',localcl);
+			
     		that.hideModal(2);
     		wx.showToast({
 	        title: '添加成功,请到购物车查看~',

+ 38 - 5
pages/projects/project-detail/project-detail.wxml

@@ -270,10 +270,29 @@
       </view>
       
       
-      <form bindsubmit="pay" report-submit="{{true}}" >
-        <button class="dialog-btn" formType="submit" wx:if="{{showpay}}" disabled="{{canpay?'':'true'}}"><text wx:if="{{!noproduct}}">立即购买</text><text wx:if="{{noproduct}}">暂无库存</text></button>
-      </form>
-      <button class="dialog-btn" open-type="share" wx:if="{{!showpay}}"><text wx:if="{{!noproduct}}">立即购买</text><text wx:if="{{noproduct}}">暂无库存</text></button>
+	  <view wx:if="{{project.is_deliver}}">
+	  	<view wx:if="{{project.deliver_state == 2}}">
+	  		<form bindsubmit="pay" report-submit="{{true}}" >
+	  		  <button class="dialog-btn" formType="submit" wx:if="{{showpay}}" disabled="{{canpay?'':'true'}}"><text wx:if="{{!noproduct}}">立即购买</text><text wx:if="{{noproduct}}">暂无库存</text></button>
+	  		</form>
+	  		<button class="dialog-btn" open-type="share" wx:if="{{!showpay}}"><text wx:if="{{!noproduct}}">立即购买</text><text wx:if="{{noproduct}}">暂无库存</text></button>
+	  	</view>
+	  		<view wx:else>
+	  			<button class="detail-yellow" style="width:100%" disabled="true">
+	  				<text wx:if="{{project.deliver_state == 1}}"><format-time type="formatTime" value="{{project.deliver_start_time}}" ></format-time>开售,敬请期待!</text>
+	  				<text wx:if="{{project.deliver_state == 2}}">预售</text>
+	  				<text wx:if="{{project.deliver_state == 3}}">已售罄</text>
+	  			</button>
+	  		</view>
+	  </view>
+	  <view wx:else>
+	  		  <form bindsubmit="pay" report-submit="{{true}}" >
+	  		    <button class="dialog-btn" formType="submit" wx:if="{{showpay}}" disabled="{{canpay?'':'true'}}"><text wx:if="{{!noproduct}}">立即购买</text><text wx:if="{{noproduct}}">暂无库存</text></button>
+	  		  </form>
+	  		  <button class="dialog-btn" open-type="share" wx:if="{{!showpay}}"><text wx:if="{{!noproduct}}">立即购买</text><text wx:if="{{noproduct}}">暂无库存</text></button>
+	  </view>
+	  
+      
     </view>
   </view>
   <view class="detail-dialog" bindtap="toPay"></view>
@@ -320,7 +339,21 @@
         </view>
       </view>
       
-      <button class="detail-yellow" bindtap="addCart" style="width:100%" disabled="{{!canpay?'true':''}}"><text wx:if="{{!noproduct}}">加入购物车</text><text wx:if="{{noproduct}}">暂无库存</text></button>
+	  <view wx:if="{{project.is_deliver}}">
+	  	<view wx:if="{{project.deliver_state == 2}}">
+	  		<button class="detail-yellow" bindtap="addCart" style="width:100%" disabled="{{!canpay?'true':''}}"><text wx:if="{{!noproduct}}">加入购物车</text><text wx:if="{{noproduct}}">暂无库存</text></button>
+	  	</view>
+		<view wx:else>
+			<button class="detail-yellow" style="width:100%" disabled="true">
+				<text wx:if="{{project.deliver_state == 1}}"><format-time type="formatTime" value="{{project.deliver_start_time}}" ></format-time>开售,敬请期待!</text>
+				<text wx:if="{{project.deliver_state == 2}}">预售</text>
+				<text wx:if="{{project.deliver_state == 3}}">已售罄</text>
+			</button>
+		</view>
+	  </view>
+      <view wx:else>
+		  <button class="detail-yellow" bindtap="addCart" style="width:100%" disabled="{{!canpay?'true':''}}"><text wx:if="{{!noproduct}}">加入购物车</text><text wx:if="{{noproduct}}">暂无库存</text></button>
+	  </view>
     </view>
   </view>
   <view class="detail-dialog" bindtap="toCart"></view>

+ 8 - 8
pages/user/all/all.wxml

@@ -117,10 +117,10 @@
 		  <view class="user-line__title">我的赠券</view>
 		  <image class="user-line__right" src="http://fohow.oss-cn-shenzhen.aliyuncs.com/xcx/user/right.png"></image>
 		</view>
-      <view class="user-line" bindtap="toInviteList">
+      <!-- <view class="user-line" bindtap="toInviteList">
         <view class="user-line__title">我的推广</view>
         <image class="user-line__right" src="http://fohow.oss-cn-shenzhen.aliyuncs.com/xcx/user/right.png"></image>
-      </view>
+      </view> -->
       <view class="user-line" bindtap="toCashList" style="border:0;" wx:if="{{userInfo.show_invite_mode}}">
         <view class="user-line__title">我的收入</view>
         <image class="user-line__right" src="http://fohow.oss-cn-shenzhen.aliyuncs.com/xcx/user/right.png"></image>
@@ -132,14 +132,14 @@
         <image class="user-line__right" src="http://fohow.oss-cn-shenzhen.aliyuncs.com/xcx/user/right.png"></image>
       </view> -->
       
-      <view class="user-line" bindtap="toIdentity">
+      <!-- <view class="user-line" bindtap="toIdentity">
         <view class="user-line__title">会员认证</view>
         <image class="user-line__right" src="http://fohow.oss-cn-shenzhen.aliyuncs.com/xcx/user/right.png"></image>
-      </view>
-      <view class="user-line" bindtap="toBankInfo">
+      </view> -->
+      <!-- <view class="user-line" bindtap="toBankInfo">
         <view class="user-line__title">银行信息</view>
         <image class="user-line__right" src="http://fohow.oss-cn-shenzhen.aliyuncs.com/xcx/user/right.png"></image>
-      </view>
+      </view> -->
       <view class="user-line" bindtap="toAddressList">
         <view class="user-line__title">收货地址</view>
         <image class="user-line__right" src="http://fohow.oss-cn-shenzhen.aliyuncs.com/xcx/user/right.png"></image>
@@ -158,10 +158,10 @@
         <image class="user-line__right" src="http://fohow.oss-cn-shenzhen.aliyuncs.com/xcx/user/right.png"></image>
       </view>
       -->
-      <view class="user-line" bindtap="toProxy" wx:if="{{userInfo.rank == 3}}">
+      <!-- <view class="user-line" bindtap="toProxy" wx:if="{{userInfo.rank == 3}}">
         <view class="user-line__title">我的代理</view>
         <image class="user-line__right" src="http://fohow.oss-cn-shenzhen.aliyuncs.com/xcx/user/right.png"></image>
-      </view>
+      </view> -->
       <view class="user-line" bindtap="toCustom" >
         <view class="user-line__title">联系客服</view>
         <image class="user-line__right" src="http://fohow.oss-cn-shenzhen.aliyuncs.com/xcx/user/right.png"></image>

+ 4 - 0
project.config.json

@@ -3,17 +3,21 @@
   "setting": {
     "urlCheck": true,
     "es6": true,
+    "enhance": false,
     "postcss": true,
     "preloadBackgroundData": false,
     "minified": true,
     "newFeature": true,
     "coverView": true,
+    "nodeModules": false,
     "autoAudits": false,
     "showShadowRootInWxmlPanel": true,
     "scopeDataCheck": false,
+    "uglifyFileName": false,
     "checkInvalidKey": true,
     "checkSiteMap": true,
     "uploadWithSourceMap": true,
+    "compileHotReLoad": false,
     "useMultiFrameRuntime": true,
     "useApiHook": true,
     "useApiHostProcess": true,

+ 2 - 2
utils/request.js

@@ -1,7 +1,7 @@
 // 新正式(未审批)
-// const apiHost = 'https://fohowapi.hiwavo.com/' 
+const apiHost = 'https://fohowapi.hiwavo.com/' 
 // 测试
-const apiHost = 'https://tfohowapi.hiwavo.com/'
+// const apiHost = 'https://tfohowapi.hiwavo.com/'
 
 
 function $get (url, params, success, fail) {