Browse Source

修改商城

zhuxiuping 2 years ago
parent
commit
2101969b22

+ 14 - 10
packageShang/pages/goods/goods.vue

@@ -236,9 +236,9 @@
 				<text>收藏</text>
 				<text>收藏</text>
 			</view>
 			</view>
 			<view class="flex1 btn-container dflex-b border-radius-big">
 			<view class="flex1 btn-container dflex-b border-radius-big">
-				<view class="tac padding-tb-sm flex1 bg-warn" v-if="goods.stockNum > goods.saleCnt && goods.state == 1" @click="tocart(goods)">加入购物车</view>
-				<view class="tac padding-tb-sm flex1 bg-base-gou" v-if="goods.stockNum > goods.saleCnt && goods.state == 1" @click="tobuy(goods)">立即购买</view>
-				<view class="tac padding-tb-sm flex1 bg-disabled" v-if="goods.stockNum == goods.saleCnt && goods.state == 1">已售磐</view>
+				<view class="tac padding-tb-sm flex1 bg-warn" v-if="goods.stockNum > 0 && goods.state == 1" @click="tocart(goods)">加入购物车</view>
+				<view class="tac padding-tb-sm flex1 bg-base-gou" v-if="goods.stockNum > 0 && goods.state == 1" @click="tobuy(goods)">立即购买</view>
+				<view class="tac padding-tb-sm flex1 bg-disabled" v-if="goods.stockNum == 0 && goods.state == 1">已售磐</view>
 				<view class="tac padding-tb-sm flex1 bg-disabled" v-if="goods.state == 0">已下架</view>
 				<view class="tac padding-tb-sm flex1 bg-disabled" v-if="goods.state == 0">已下架</view>
 			</view>
 			</view>
 		</view>
 		</view>
@@ -312,12 +312,12 @@
 				</view>
 				</view>
 
 
 				<view class="pop_num">
 				<view class="pop_num">
-					<uni-number-box @change="changeValue" />
+					<uni-number-box @change="changeValue" v-model="vModelValue" />
 				</view>
 				</view>
 				<view class="flex1 btn-container dflex-b border-radius-big" style="margin-top: 50px">
 				<view class="flex1 btn-container dflex-b border-radius-big" style="margin-top: 50px">
-					<view class="tac padding-tb-sm flex1 bg-warn" v-if="goods.stockNum > goods.saleCnt && goods.state == 1" @click="tocartSKU(goods)">加入购物车</view>
-					<view class="tac padding-tb-sm flex1 bg-base-gou" v-if="goods.stockNum > goods.saleCnt && goods.state == 1" @click="tobuySku(goods)">立即购买</view>
-					<view class="tac padding-tb-sm flex1 bg-disabled" v-if="goods.stockNum == goods.saleCnt && goods.state == 1">已售磐</view>
+					<view class="tac padding-tb-sm flex1 bg-warn" v-if="goods.stockNum > 0 && goods.state == 1" @click="tocartSKU(goods)">加入购物车</view>
+					<view class="tac padding-tb-sm flex1 bg-base-gou" v-if="goods.stockNum > 0 && goods.state == 1" @click="tobuySku(goods)">立即购买</view>
+					<view class="tac padding-tb-sm flex1 bg-disabled" v-if="goods.stockNum == 0 && goods.state == 1">已售磐</view>
 					<view class="tac padding-tb-sm flex1 bg-disabled" v-if="goods.state == 0">已下架</view>
 					<view class="tac padding-tb-sm flex1 bg-disabled" v-if="goods.state == 0">已下架</view>
 				</view>
 				</view>
 			</view>
 			</view>
@@ -390,7 +390,8 @@ export default {
 			favorite: false, //是否收藏
 			favorite: false, //是否收藏
 
 
 			scrollTop: 0,
 			scrollTop: 0,
-			skuAttrDatas: [] //商品属性数组
+			skuAttrDatas: [] ,//商品属性数组
+			vModelValue:1,//加购数量
 		}
 		}
 	},
 	},
 	watch: {
 	watch: {
@@ -845,9 +846,12 @@ export default {
 		},
 		},
 		changeValue(value) {
 		changeValue(value) {
 			console.log('返回数值:', value)
 			console.log('返回数值:', value)
-			if (value > this.cartSale) {
+			if (value > this.cartSale) {
+				this.$api.msg('购买量不能大于库存');
+				this.vModelValue=this.cartSale
 				this.cartNum = this.cartSale
 				this.cartNum = this.cartSale
-			} else {
+			} else {
+				this.vModelValue=value
 				this.cartNum = value
 				this.cartNum = value
 			}
 			}
 		}
 		}

+ 7 - 2
packageShang/pages/order/create.vue

@@ -189,6 +189,9 @@
 			this.goods_id = options.goods_id || '';
 			this.goods_id = options.goods_id || '';
 			this.goods_num=options.num
 			this.goods_num=options.num
 			// 商品 sku
 			// 商品 sku
+			// if (options.skuId) {
+			// this.goods_sku_id = options.skuId.split(',') || '';
+			// }
 			this.goods_sku_id = options.skuId || '';
 			this.goods_sku_id = options.skuId || '';
 
 
 			// 购物车 ids
 			// 购物车 ids
@@ -224,14 +227,16 @@
 				_self.submitToken=''
 				_self.submitToken=''
 				if(_self.type==1){
 				if(_self.type==1){
 					var goodsId=_self.goods_id
 					var goodsId=_self.goods_id
+					var good_sku=_self.goods_sku_id
 				}else{
 				}else{
 					var goodsId=''//_self.cart_ids.toString()
 					var goodsId=''//_self.cart_ids.toString()
+					var good_sku=''
 				}
 				}
 				// 确认订单
 				// 确认订单
 				var data={
 				var data={
 					"type": _self.type,
 					"type": _self.type,
 					"goodId": goodsId,
 					"goodId": goodsId,
-					"skuId":_self.goods_sku_id,
+					"skuId":good_sku,
 					"num":_self.goods_num
 					"num":_self.goods_num
 				}
 				}
 				confirmorder(data).then((res) => {
 				confirmorder(data).then((res) => {
@@ -358,7 +363,7 @@
 						});
 						});
 						return
 						return
 					}
 					}
-					_this.$api.msg(res.msg);
+					_this.$api.msg(res.message);
 					_this.is_submit = 0;
 					_this.is_submit = 0;
 				})
 				})
 			},
 			},

+ 2 - 2
packageShang/pages/pay/success.vue

@@ -30,8 +30,8 @@ export default {
 		},
 		},
 		//返回首页
 		//返回首页
 		fanhui(){
 		fanhui(){
-			uni.switchTab({
-				url:'pages/home3/home3'
+			uni.redirectTo({
+				url:'/packageShang/pages/tabbar/home'
 			})
 			})
 		}
 		}
 	}
 	}

+ 3 - 4
packageShang/pages/tabbar/cart.vue

@@ -29,7 +29,7 @@
 
 
 							<view v-if="item.limitNum < item.goodsCount" class="disabled dflex-c dflex-flow-c pos-a pos-tl-c border-radius-c">
 							<view v-if="item.limitNum < item.goodsCount" class="disabled dflex-c dflex-flow-c pos-a pos-tl-c border-radius-c">
 								<text>库存不足</text>
 								<text>库存不足</text>
-								<text class="margin-left-xs fs-xs" v-if="item.limitNum > 0">剩余 {{ item.limitNum }}</text>
+								<!-- <text class="margin-left-xs fs-xs" v-if="item.limitNum > 0">剩余 {{ item.limitNum }}</text> -->
 							</view>
 							</view>
 						</view>
 						</view>
 						<view class="item-right padding-left pos-r">
 						<view class="item-right padding-left pos-r">
@@ -306,11 +306,10 @@ export default {
 		// +- 数量
 		// +- 数量
 		numberChange(data) {
 		numberChange(data) {
 			var _self = this
 			var _self = this
-			let cart = _self.cartDatas[data.index]
+			let cart = _self.cartDatas[data.index]
 			var num = data.number - _self.cartDatas[data.index].goodsCount
 			var num = data.number - _self.cartDatas[data.index].goodsCount
-			changecart
 			//修改购物车接口
 			//修改购物车接口
-			var params = '?num=' + num + '&goodId=' + cart.goodsId
+			var params = '?num=' + num + '&goodId=' + cart.goodsId+'&skuId='+cart.skuId
 			var header = {
 			var header = {
 				'Mall-Token': uni.getStorageSync('tokenId')
 				'Mall-Token': uni.getStorageSync('tokenId')
 			}
 			}

+ 15 - 6
packageShang/pages/user/order/order-detail.vue

@@ -9,11 +9,12 @@
 						<text class="iconfont icondaifukuan- fs-lg fwb"></text>
 						<text class="iconfont icondaifukuan- fs-lg fwb"></text>
 						<text class="fwb margin-left-sm">订单待支付</text>
 						<text class="fwb margin-left-sm">订单待支付</text>
 					</view>
 					</view>
-					<!-- <view class="dflex-c">
+					<view class="dflex-c">
 						剩余时间:
 						剩余时间:
-						<use-count-down :show-days="false" separator="zh" separator-color="#fff" font-size="24"
-							:timestamp="time_remaining"></use-count-down>
-					</view> -->
+						<uv-count-down v-if="time_remaining" :time="time_remaining" format="mm:ss" @finish="finish()"></uv-count-down>
+						<!-- <use-count-down :show-days="false" separator="zh" separator-color="#fff" font-size="24"
+							:timestamp="time_remaining"></use-count-down> -->
+					</view>
 				</view>
 				</view>
 
 
 				<view v-if="order_data.state == '2'">
 				<view v-if="order_data.state == '2'">
@@ -29,7 +30,7 @@
 						<text class="iconfont icondaishouhuo- fs-lg fwb"></text>
 						<text class="iconfont icondaishouhuo- fs-lg fwb"></text>
 						<text class="fwb margin-left-sm">订单已发货</text>
 						<text class="fwb margin-left-sm">订单已发货</text>
 					</view>
 					</view>
-					<view class="dflex-c">还剩15天10时自动确认</view>
+					<!-- <view class="dflex-c">还剩15天10时自动确认</view> -->
 				</view>
 				</view>
 
 
 				<view v-if="order_data.state == '4'">
 				<view v-if="order_data.state == '4'">
@@ -37,7 +38,7 @@
 						<text class="iconfont iconyiwancheng- fs-lg fwb"></text>
 						<text class="iconfont iconyiwancheng- fs-lg fwb"></text>
 						<text class="fwb margin-left-sm">订单已收货</text>
 						<text class="fwb margin-left-sm">订单已收货</text>
 					</view>
 					</view>
-					<view class="dflex-c">感谢您的支持,评价送积分</view>
+					<view class="dflex-c">感谢您的支持</view>
 				</view>
 				</view>
 				
 				
 				<view v-if="order_data.state == '5'">
 				<view v-if="order_data.state == '5'">
@@ -287,6 +288,10 @@
 					if(res.success){
 					if(res.success){
 						_this.order_data = res.data;
 						_this.order_data = res.data;
 						_this.order_detail = res.data.orderDetails;
 						_this.order_detail = res.data.orderDetails;
+						let temLockTime = 15
+						// 兼容ios部分系统转换时间格式
+						let createTime = res.data.createTime.slice(0, 19).replace(/-/g, '/')
+						_this.time_remaining = new Date(createTime).getTime() + temLockTime * 60 * 1000 - new Date().getTime()
 						return
 						return
 					}
 					}
 					_this.$api.msg(res.msg);
 					_this.$api.msg(res.msg);
@@ -315,6 +320,10 @@
 				// 	}
 				// 	}
 				// })
 				// })
 			},
 			},
+			// 倒计时结束回调
+			finish() {
+				this.loadData()
+			},
 			// 立即支付
 			// 立即支付
 			payment() {
 			payment() {
 				if (this.order_data.order_pay_state == '待核实') {
 				if (this.order_data.order_pay_state == '待核实') {

+ 7 - 5
pages/push/push.vue

@@ -37,7 +37,7 @@
 				</view>
 				</view>
 				<view class="info_msg">{{ orderInfo.houseName }}</view>
 				<view class="info_msg">{{ orderInfo.houseName }}</view>
 				<view class="info_type">
 				<view class="info_type">
-					<view class="type_item">{{ orderInfo.hotelType }}</view>
+					<view class="type_item">{{ orderInfo.hotelType }}</view>
 				</view>
 				</view>
 				<view class="info_tag">
 				<view class="info_tag">
 					<view class="tag_item" v-if="orderInfo.houseAreas">{{ orderInfo.houseAreas }}㎡</view>
 					<view class="tag_item" v-if="orderInfo.houseAreas">{{ orderInfo.houseAreas }}㎡</view>
@@ -188,8 +188,9 @@ export default {
 				url: '/pages/home3/home3'
 				url: '/pages/home3/home3'
 			})
 			})
 		},
 		},
-		getWeek(time) {
-			let date = new Date(time)
+		getWeek(time) {
+			let rgTime = time.replace(/-/g, '/')
+			let date = new Date(rgTime)
 			// 获取星期
 			// 获取星期
 			let week = date.getDay()
 			let week = date.getDay()
 			let weekList = ['日', '一', '二', '三', '四', '五', '六']
 			let weekList = ['日', '一', '二', '三', '四', '五', '六']
@@ -197,8 +198,9 @@ export default {
 			let res = '周' + weekList[week]
 			let res = '周' + weekList[week]
 			return res
 			return res
 		},
 		},
-		getTime(time) {
-			let date = new Date(time)
+		getTime(time) {
+			let rgTime = time.replace(/-/g, '/')
+			let date = new Date(rgTime)
 			// 获取月份
 			// 获取月份
 			let M = date.getMonth() + 1
 			let M = date.getMonth() + 1
 			// 获取日期
 			// 获取日期