瀏覽代碼

积分增加规格,申请店长调整图片

junyuanz 4 年之前
父節點
當前提交
3d87bf5b84

+ 15 - 1
packageUser/pages/user/applyLeader/applyLeader.js

@@ -12,10 +12,12 @@ Page({
     yzm:'',
     remark:'',
     userinfo:{},
-    showpage:0
+    showpage:0,
+	adimg:''
   },
   onLoad: function (options) {
   	this.getUserInfo();
+	this.getADimg();
   },
   getUserInfo(){
   	var that = this
@@ -29,6 +31,18 @@ Page({
     }
     _request.$get(url, params, success)
   },
+  getADimg(){
+  	var that = this
+    var url = 'v1/ad/shop_apply/items'
+    var params = {}
+    var success = function (res) {
+    	console.log(res);
+		that.setData({
+			adimg: res.data[0].img
+		})
+    }
+    _request.$get(url, params, success)
+  },
   getTel (val) {
     console.log(val)
     if (val.detail.encryptedData) {

+ 1 - 1
packageUser/pages/user/applyLeader/applyLeader.wxml

@@ -1,5 +1,5 @@
 <view class="bg" wx:if="{{showpage == 0}}">
-  <image src="http://fohow.oss-cn-shenzhen.aliyuncs.com/xcx/apply.jpg" class="item-index" mode="widthFix" style="width:100%"/>
+  <image src="{{adimg}}" class="item-index" mode="widthFix" style="width:100%"/>
   <view class="newAddress-line">
     <view class="newAddress-title">金 额</view>
     <input maxlength="11" class="nameText" style="color:#eab86a" disabled="disabled" value="16800" wx:if="{{userinfo.rank == 0}}"/>

+ 8 - 4
pages/areacart/areacart.wxml

@@ -62,10 +62,7 @@
 										<p>{{pack.item_title}} x{{pack.nums}}</p>
 									</view>
 								</view>
-								<view wx:if="{{item.have_size}}">
-									<view class="typeselect" bindtap="selectSize" data-val="{{item.id}}" data-item="{{index}}" wx:if="{{item.color_name || item.size_name}}">已选规格: {{item.color_name}} {{item.size_name}}</view>
-									<view class="typeselect" bindtap="selectSize" data-val="{{item.id}}" data-item="{{index}}" wx:else>商品规格:未选择</view>
-								</view>
+								
 						        <view class="cartlist_type">零售价:<currency symbol="¥" value="{{item.user_sale_price}}" /> </view>
 						        <currency class="cartlist_price" symbol="¥" value="{{item.price}}" />
 						        <view class="cartlist_num">
@@ -73,7 +70,14 @@
 						        	<input type="number" value="{{item.count}}" bindinput="changeCount" data-id='{{item.id}}' data-index="{{index}}"/>
 						        	<button bindtap="add" data-id='{{item.id}}' data-count="{{item.count}}" data-index="{{index}}" class="add">+</button>
 						        </view>
+								
+								<view wx:if="{{item.have_size}}">
+									<view class="typeselect" bindtap="selectSize" data-val="{{item.id}}" data-item="{{index}}" wx:if="{{item.color_name || item.size_name}}">已选规格: {{item.color_name}} {{item.size_name}}</view>
+									<view class="typeselect" bindtap="selectSize" data-val="{{item.id}}" data-item="{{index}}" wx:else>商品规格:未选择</view>
+								</view>
+								
 						      </view>
+							  
 							  <view wx:if="{{item.is_deliver}}" class="project-miaosha">
 							  	<span wx:if="{{item.deliver_state == 1}}"><format-time type="formatTime" value="{{item.deliver_start_time}}" ></format-time>开售,敬请期待!</span>
 							  	<span wx:if="{{item.deliver_state == 2}}">预售</span>

+ 2 - 2
pages/areacart/areacart.wxss

@@ -544,7 +544,7 @@ movable-area {
  
 movable-view {
   width: calc(100% + 184rpx);
-  height: 260rpx;
+  height: 280rpx;
 }
  
 .main_item_content {
@@ -553,7 +553,7 @@ movable-view {
  
 .delete_btn {
   width: 184rpx;
-  height: 260rpx;
+  height: 280rpx;
   background-color: #f2f4f6;
   border-top-right-radius: 10px;
   border-bottom-right-radius: 10px;

+ 288 - 15
pages/centcart/centcart.js

@@ -19,7 +19,9 @@ Page({
     nowpage:1,
     cartMore:true,
     cent:0,
-    centlist: []
+    centlist: [],
+	showDialog: false,
+	checkbox:'',
   },
   handleMovableChange: function(e) {
     // this.data.currentX = e.detail.x;
@@ -53,6 +55,9 @@ Page({
   		submitlock: false,
   		selectedall: false
   	});
+	this.setData({submitlock: false});
+  	this.setData({selectedall: false});
+	this.getIphoneX()
   },
   onShow: function () {
 //	this.getCartListAndSelected();
@@ -98,6 +103,7 @@ Page({
     			res.data.list[i]['movex'] = 0;
     			res.data.list[i]['IsBuy'] = false;
     			res.data.list[i]['count'] = 1;
+				res.data.list[i]['overtype'] = res.data.list[i]['have_size'] ? false:true;
     		}
     		that.setData({
     			cartMore: res.data.list_count > that.data.cartList.length,
@@ -272,16 +278,34 @@ Page({
     this.getCartList();
   },
   itemselected:function(e){
-  	console.log(this)
-  	var nowitems = this.data.selectedItems;
-  	let index = e.currentTarget.dataset.index;
-  	var bool = this.data.cartList[index].IsBuy;
-  	console.log('bool',bool)
-    this.setData({
-      ['cartList[' + index + '].IsBuy']: !bool
-    })
-    
-  	this.checkSelected();
+	console.log(this)
+	var nowitems = this.data.selectedItems;
+	let index = e.currentTarget.dataset.index;
+	var bool = this.data.cartList[index].IsBuy;
+	var overtype = this.data.cartList[index].overtype;
+	console.log('bool',bool)
+	if(overtype){
+		if(this.data.cartList[index].is_deliver && (this.data.cartList[index].deliver_state == 1 || this.data.cartList[index].deliver_state == 3)){
+			var txt = this.data.cartList[index].deliver_state == 1 ? '商品正在预售中暂未开放购买~' : '商品已售罄~';
+			wx.showToast({
+			    title: txt,
+			    icon: 'none',
+			    duration: 3000
+			  })
+		}else{
+			this.setData({
+			  ['cartList[' + index + '].IsBuy']: !bool
+			})
+			
+			this.checkSelected();
+		}
+	}else{
+		wx.showToast({
+		    title: '商品 '+this.data.cartList[index].name+' 请先选择规格~',
+		    icon: 'none',
+		    duration: 3000
+		  })
+	}
   },
   allSelect:function(){
   	if(this.data.selectedall){
@@ -295,9 +319,26 @@ Page({
 	    })
   	}else{
   		for(var i in this.data.cartList){
-  			this.setData({
-		      ['cartList[' + i + '].IsBuy']: true
-		    })
+			if(this.data.cartList[i].overtype){
+				if(this.data.cartList[i].is_deliver && (this.data.cartList[i].deliver_state == 1 || this.data.cartList[i].deliver_state == 3)){
+					var txt = this.data.cartList[i].deliver_state == 1 ? '商品正在预售中暂未开放购买~' : '商品已售罄~';
+					wx.showToast({
+					    title: txt,
+					    icon: 'none',
+					    duration: 3000
+					  })
+				}else{
+					this.setData({
+					  ['cartList[' + i + '].IsBuy']: true
+					})
+				}
+			}else{
+				wx.showToast({
+				    title: '商品 '+this.data.cartList[i].name+' 请先选择规格~',
+				    icon: 'none',
+				    duration: 3000
+				  })
+			}
   		}
   		this.setData({
 	      selectedall: true
@@ -438,5 +479,237 @@ Page({
   	  wx.navigateTo({
   	    url: '/pages/projects/project-detail/project-detail?id=' + id + '&read=1'
   	  })
-  }
+  },
+  getIphoneX () {
+    var that = this
+    wx.getSystemInfo({
+      success: function (res) {
+        if (res.model.toLowerCase().indexOf('iphone x') > -1) {
+          that.setData({
+            value: 34
+          })
+        }
+      }
+    })
+  },
+  selectSize:function(val){
+  	  var that = this
+  	  var id = val.currentTarget.dataset.val;
+  	  var item = val.currentTarget.dataset.item;
+  	  that.setData({
+  	    selectProjectid: id,
+  		selectProjectItem: item
+  	  });
+  	  
+  	  console.log('id',id);
+  	  that.getProjectDetail();
+  	  that.getProductSize();
+  	  
+  	  var animation = wx.createAnimation({
+  	    duration: 200,
+  	    timingFunction: "ease-out"
+  	  })
+  	  this.animation = animation
+  	  animation.translateY(500).step()
+  	  this.setData({
+  		animationData: animation.export(),
+  		showDialog: true
+  	  })
+  	  
+  	  setTimeout(function () {
+  	    animation.translateY(0).step()
+  	    this.setData({
+  	      animationData: animation.export()
+  	    })
+  	  }.bind(this), 200)
+  	  
+  	  
+  	  
+  },
+  getProjectDetail() {
+    var that = this
+    var url = "v1/product/" + that.data.selectProjectid;
+    var params = {}
+    var success = function (val) {
+      var p = val.data.detail
+      that.setData({
+        selectProject: val.data
+      });
+      if(val.data.have_size){
+      	// that.getProductSize();
+      }
+    }
+    _request.$get(url, params, success)
+  },
+  getProductSize(){
+  	var that = this
+    var url = "v1/product_size/" + that.data.selectProjectid;
+    var params = {}
+    var success = function (val) {
+    	let cbox = [];
+    	for(let i in val.data){
+    		if(i != 'product' && val.data[i]) cbox.push(i);
+    	}
+    	console.log('cbox',cbox)
+      that.setData({
+        selectProjectSize: val.data,
+        checkbox:cbox
+      });
+    }
+    _request.$get(url, params, success)
+  },
+  hideDialog:function(e){
+  	  var that = this
+  	  that.data.showDialog = !that.data.showDialog
+  	  if (that.data.showDialog) {
+  	    that.showModal(1)
+  	  } else {
+  	    that.hideModal(1)
+  	  }
+  },
+  // 显示弹框
+  showModal: function (type) {
+    var animation = wx.createAnimation({
+      duration: 200,
+      timingFunction: "ease-out"
+    })
+    this.animation = animation
+    animation.translateY(500).step()
+    if(type == 1){
+    	this.setData({
+  	      animationData: animation.export(),
+  	      showDialog: true
+  	    })
+    }else{
+    	this.setData({
+  	      animationData: animation.export(),
+  	      showCartDialog: true
+  	    })
+    }
+    
+    setTimeout(function () {
+      animation.translateY(0).step()
+      this.setData({
+        animationData: animation.export()
+      })
+    }.bind(this), 200)
+  },
+  // 隐藏弹框
+  hideModal: function (type = 1) {
+    var animation = wx.createAnimation({
+      duration: 200,
+      timingFunction: "ease-out"
+    })
+    this.animation = animation
+    animation.translateY(500).step()
+    this.setData({
+      animationData: animation.export(),
+    })
+    setTimeout(function () {
+      animation.translateY(0).step()
+      if(type == 1){
+      	this.setData({
+  	        animationData: animation.export(),
+  	        showDialog: false
+  	      })
+      }else{
+      	this.setData({
+  	        animationData: animation.export(),
+  	        showCartDialog: false
+  	      })
+      }
+      
+    }.bind(this), 200)
+  },
+  checkSize(event){
+    	var type = event.currentTarget.dataset.type;
+    	var id = event.currentTarget.dataset.id;
+    	var list = event.currentTarget.dataset.list;
+    	var tname = event.currentTarget.dataset.tname;
+  		var that = this;
+  		var tkey = type=='color_list'?'cname':'sname';
+  		var reproduct = this.data.selectProjectSize;
+  //		console.log('reproduct',reproduct)
+  		for(var i in reproduct[type]['attr_values']){
+  //			console.log('reproduct[type][i].is_select',reproduct[type]['attr_values'][i].is_select)
+  			reproduct[type]['attr_values'][i].is_select = false;
+  			if(reproduct[type]['attr_values'][i].id == id) reproduct[type]['attr_values'][i].is_select = true;
+  		}
+  //		console.log('reproduct',reproduct)
+  		
+  		that.setData({
+  			selectProjectSize :reproduct,
+  			[type]:id,
+  			[tkey]:tname
+  		})
+  		console.log('that.data[type]',that.data[type])
+  		let cflag = true;
+  		for(let i in that.data.checkbox){
+  			if(that.data[that.data.checkbox[i]] == 0) cflag = false;
+  		}
+  		if(cflag){
+    		that.getProductDetail();
+  		}
+  
+    },
+  	getProductDetail () {
+  	  var that = this;
+  	  console.log(that.data.size_list);
+  	  console.log(that.data.color_list);
+  	  var sizelist = that.data.size_list ? that.data.size_list : 0;
+  	  var colorlist = that.data.color_list ? that.data.color_list : 0;
+  	  
+  	  var url = "v1/product_detail/" + that.data.selectProjectid + "/" + sizelist + "/" + colorlist;
+  	  var params = {}
+  	  var success = function (val) {
+  		console.log('val',val)
+  		if(val.data.product){
+  			that.setData({
+  				canpay:true,
+  				selectProject:val.data.product,
+  				selectProjectid:val.data.product.id,
+  				noproduct:false
+  			})
+  			that.setData({
+  				canpay:true,
+  				selectProject:val.data.product,
+  				selectProjectid:val.data.product.id,
+  				noproduct:false
+  			})
+  		}else{
+  			that.setData({
+  				canpay:false,
+  				noproduct:true
+  			})
+  		}
+  	  }
+  	  var fail = function(err){
+  	  	
+  	  }
+  	  _request.$get(url, params, success, fail)
+  	},
+  	selectType:function(){
+  		var that = this;
+  		var itemindex = this.data.selectProjectItem;
+  		var itemdata = this.data.selectProject;
+  		console.log('xuanzzzzz')
+  		console.log(this.data.cartList)
+  		console.log(this.data.selectProject)
+  		console.log(this.data.selectProjectItem)
+  		itemdata['count']=1;
+  		itemdata['IsBuy']=false;
+  		itemdata['movex']=0;
+  		itemdata['overtype']=true;
+  		that.setData({
+  			['cartList[' + itemindex + ']']:itemdata
+  		})
+  		that.hideModal(1);
+  	},
+  	selectTypeno:function(){
+  		wx.showToast({
+  		  title: '选中的规格暂无库存,请选择其他规格~',
+  		  icon: 'none',
+  		  duration: 2000
+  		})
+  	}
 })

+ 52 - 1
pages/centcart/centcart.wxml

@@ -80,7 +80,17 @@
 						        	<input type="number" value="{{item.count}}" bindinput="changeCount" data-id='{{item.id}}' data-index="{{index}}"/>
 						        	<button bindtap="add" data-id='{{item.id}}' data-count="{{item.count}}" data-index="{{index}}" class="add">+</button>
 						        </view>
+								
+								<view wx:if="{{item.have_size}}">
+									<view class="typeselect" bindtap="selectSize" data-val="{{item.id}}" data-item="{{index}}" wx:if="{{item.color_name || item.size_name}}">已选规格: {{item.color_name}} {{item.size_name}}</view>
+									<view class="typeselect" bindtap="selectSize" data-val="{{item.id}}" data-item="{{index}}" wx:else>商品规格:未选择</view>
+								</view>
 						      </view>
+							  <view wx:if="{{item.is_deliver}}" class="project-miaosha">
+							  	<span wx:if="{{item.deliver_state == 1}}"><format-time type="formatTime" value="{{item.deliver_start_time}}" ></format-time>开售,敬请期待!</span>
+							  	<span wx:if="{{item.deliver_state == 2}}">预售</span>
+							  	<span wx:if="{{item.deliver_state == 3}}">已售罄</span>
+							  </view>
 							  <button class="xqbtn" bindtap="toProject" data-val="{{item.id}}">查看详情 ></button> 
 						      <view class='clear'></view>
 						  </view>
@@ -177,4 +187,45 @@
     <view class="btn-confirm" bindtap="onConfirm" data-status="confirm">前往兑换</view>
   </view>
 </view>
--->
+-->
+
+
+<view wx:if="{{showDialog}}">
+  <view class="dialog-panel" animation="{{animationData}}" style="padding-bottom: {{value}}rpx;">
+    <view class="dialog-project">
+      <image class="dialog-cancel" src="http://fohow.oss-cn-shenzhen.aliyuncs.com/xcx/image/cancel.png" bindtap="hideDialog"></image>
+      <view class="dialog-content">
+        <image class="dialog-img" src="{{selectProject.pics[0].img}}"></image>
+        
+        <view class="dialog-info" style="margin-top: 20rpx;">
+          <h6 style="font-size: 35rpx;font-weight: bold;color: #666;">{{selectProject.name}}</h6>
+          <view class="dialog-word dialog-black" style="margin-top: 15rpx;color: #999;">库存{{selectProject.left_count}}件   <text wx:if="{{selectProject.have_size && (sname || cname)}}">(已选:{{cname}} {{sname}})</text></view>
+          <view class="dialog-word dialog-red" style="font-size: 35rpx;margin-top: 25rpx;">
+            <currency symbol="¥" value="{{selectProject.price}}"></currency>
+          </view>
+        </view>
+        <view class="clean"></view>
+      </view>
+
+		<view wx:if="{{selectProject.have_size}}" class="select-count">
+			<view wx:for="{{selectProjectSize}}" wx:for-item="i" wx:key="{{index}}">
+				<view wx:if="{{index != 'product'}}">
+						<h5 class="sizeTitle">{{i.name}}</h5>
+						<view wx:for="{{i.attr_values}}" wx:for-index="index2" wx:for-item="j" class="checkList">
+							<span bindtap="checkSize" data-type='{{index}}' data-tname="{{j.name}}" data-list="{{index2}}" data-id="{{j.id}}" class="{{j.is_select?'active':''}}">
+							{{j.name}}
+							</span>
+						</view>
+					</view>
+		  </view>
+		</view>
+
+      <form  >
+        <button class="dialog-btn" bindtap="selectType" wx:if="{{!noproduct}}"><text>选定规格</text></button>
+		<button class="dialog-btn" wx:if="{{noproduct}}" disabled="disabled"><text>暂无库存</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 class="detail-dialog" bindtap="hideDialog"></view>
+</view>

+ 153 - 0
pages/centcart/centcart.wxss

@@ -595,4 +595,157 @@ movable-view {
 	    line-height: 36rpx;
 	    color: #666;
 		margin: 10rpx 0 ;
+}
+
+
+.typeselect{
+font-size: 22rpx;
+    border: 1px solid #ddd;
+    display: inline-block;
+    padding: 3rpx 35rpx;
+    border-radius: 45px;
+    color: #666;
+    margin-top: 5rpx;
+}
+
+
+.detail-dialog {
+  position: fixed;
+  top: 0;
+  width: 100%;
+  height: 100%;
+  background: rgba(0,0,0,0.4);
+  z-index: 99;
+}
+.dialog-panel {
+  position: fixed;
+  bottom: 0;
+  width: 100%;
+  background: #fff;
+  z-index: 100;
+}
+.dialog-project {
+  position: relative;
+  padding-top: 20rpx;
+}
+.dialog-content {
+  padding-bottom: 20rpx;
+  border-bottom: 1rpx solid #eee;
+}
+.dialog-info {
+  float: left;
+  margin-top: 80rpx;
+}
+.dialog-img {
+  float: left;
+  width: 220rpx;
+  height: 220rpx;
+  margin: 0 20rpx;
+}
+.dialog-word {
+  font-size: 28rpx;
+}
+.dialog-red {
+  color: #eab86a;
+  margin-bottom: 20rpx;
+}
+.dialog-gray {
+  color: #bbb;
+  margin-bottom: 10rpx;
+}
+.dialog-black {
+  color: #4c4c4c;
+}
+.dialog-btn {
+  width: 100%;
+  height: 88rpx;
+  line-height: 88rpx;
+  background: #eab86a;
+  color: #fff;
+  font-size: 28rpx;
+  text-align: center;
+  border-radius: 0rpx;
+}
+.dialog-cancel {
+  position: absolute;
+  right: 20rpx;
+  top: 20rpx;
+  width: 36rpx;
+  height: 36rpx;
+}
+.select-count {
+  width: 100%;
+  margin-top: 30rpx;
+  padding: 0 20rpx;
+  box-sizing: border-box;
+  margin-bottom: 30rpx;
+}
+.select-word {
+  float: left;
+  font-size: 24rpx;
+  color: #4c4c4c;
+  line-height: 66rpx;
+}
+.select-input {
+  float: right;
+  height: 66rpx;
+  font-size: 0;
+}
+.select-input button {
+  width: 60rpx;
+  height: 66rpx;
+  color: #999;
+  font-size: 48rpx;
+  text-align: center;
+  padding: 0;
+  display: inline-block;
+  background: #fff;
+  border-radius: 0;
+  line-height: 50rpx;
+  box-sizing: border-box;
+}
+/*.select-input button:first-child {
+  border-top-right-radius: 0;
+  border-bottom-right-radius: 0;
+}
+.select-input button:last-child {
+  border-top-left-radius: 0;
+  border-bottom-left-radius: 0;
+}*/
+.select-input button:after {
+  border-radius: 0;
+}
+.select-input input {
+  width: 154rpx;
+  height: 66rpx;
+  background-color: #f3f3f3;
+  color: #4c4c4c;
+  font-size: 28rpx;
+  text-align: center;
+  display: inline-block;
+  border-radius: 0;
+}
+.sizeTitle{display: block;font-size:24rpx}
+.checkList{display: inline-block;}
+.checkList span{
+display: inline-block;
+padding: 12rpx;
+margin: 15rpx;
+text-align: center;
+min-width: 45rpx;
+background: #eee;
+font-size:24rpx;
+}
+.checkList span.active{
+	background:#eab86a;
+	color:#FFF;
+}
+.project-miaosha{
+    position: absolute;
+    left: 25rpx;
+    bottom: 24rpx;
+    font-size: 24rpx;
+    background: #ddd;
+    padding: 2rpx 20rpx;
+    border-radius: 15rpx;
 }