| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613 | 
							- <template>
 
- <view class="box">
 
- 	<view class="topBox" ></view>
 
- 	<view class="yuanhu" ></view>
 
- 	<view class="goodsBox">
 
- 		<view class="goodsBoxLeft">
 
- 			<image :src="goodsInfo.ImgList[0].url" mode="" v-if="goodsInfo.ImgList.length>0" class="hotGoodsLineImg"></image>
 
- 			<image src="../../static/timg/noimg.png" v-else class="hotGoodsLineImg" ></image>
 
- 		</view>
 
- 		<view class="goodsBoxRgiht">
 
- 			<view class="goodsName">{{goodsInfo.name}}</view>
 
- 			<view class="goodsBottom">
 
- 				<view class="goodsPrice"> <span class="goodsPrice1">¥</span> {{goodsInfo.salePrice?goodsInfo.salePrice:goodsInfo.scribingPrice}}
 
- 				 <span v-if="goodsInfo.categoryIds=='7B97D114-C419-42B2-9C1E-0B4CA284CDA0'">万</span>
 
- 				</view>
 
- 				<view class="numJsbox">
 
- 					<view class="numJj" @click="calculation(1)">-</view>
 
- 					<view class="goodsnum">
 
- 					<input type="number" @input="inputChange" value="" v-model="goodsnum" class="goodsnumInput"/>
 
- 					</view>
 
- 					<view class="numJj" @click="calculation(2)">+</view>
 
- 				</view>
 
- 			</view>
 
- 		</view>
 
- 	</view>
 
- 	<view class="cont">
 
- 		<view class="contKk">
 
- 			<view class="contLine">
 
- 				<view class="contlineLeft">服务门店</view>
 
- 				<view class="contlineRight">{{shopName}}</view>
 
- 			</view>
 
- 			<view class="contLine">
 
- 				<view class="contlineLeft">服务车辆</view>
 
- 				<view class="contlineRight2" @click="goCarlist">
 
- 					<view>
 
- 						<span>{{carInfo.plateNumber}}</span>
 
- 						<image src="../../static/timg/icon_arrow_right.png" mode="" class="contlineRightJt"></image>
 
- 					</view>
 
- 					<view class="carModelCK">
 
- 						{{carInfo.carModel?carInfo.carModel:'暂无'}}
 
- 					</view>
 
- 					
 
- 				</view>
 
- 			</view>
 
- 			<!-- <view class="contLine">
 
- 				<view class="contlineLeft">车型</view>
 
- 				<view class="contlineRight carModelRight" @click="goCarlist">
 
- 					<span class="carModel">{{carInfo.carModel?carInfo.carModel:'选择车型'}}</span>
 
- 					<image src="../../static/timg/icon_arrow_right.png" mode="" class="contlineRightJt"></image>
 
- 				</view>
 
- 			</view> -->
 
- 			<view class="contLine">
 
- 				<view class="contlineLeft">联系人</view>
 
- 				<view class="contlineRight">
 
- 					<input type="text" v-model="customerName" placeholder="请输入联系人姓名" class="contlineRightInput">
 
- 				</view>
 
- 			</view>
 
- 			<view class="contLine " style="border-bottom: none;">
 
- 				<view class="contlineLeft">手机号</view>
 
- 				<view class="contlineRight">
 
- 					<input type="text" v-model="mobilePhone" placeholder="请输入联系人手机号" class="contlineRightInput">
 
- 				</view>
 
- 			</view>
 
- 		</view>
 
- 		
 
- 		<view class="contKk" style="margin-top:20rpx;">
 
- 			<view class="contLine2 " style="border-bottom: none;">
 
- 				<view class="contlineLeft">订单备注</view>
 
- 				<!-- <view class="contlineRight">
 
- 					<input type="text" v-model="comment" placeholder="请输入" class="contlineRightInput2">
 
- 				</view> -->
 
- 				<view style="padding-top: 15rpx;">
 
- 					<textarea placeholder-style="color:#999999" placeholder="请输入" v-model="comment"
 
- 							class="textareaCont" maxlength="-1" auto-height="true"  />
 
- 				</view>
 
- 			</view>
 
- 		</view>
 
- 	</view>
 
- 	
 
- 	<view style="height:120rpx"></view>
 
- 	<view class="bottomBox" >
 
- 		<view class="bottomLeft">
 
- 			<view class="bottomLeftLine">合计 <span>¥</span> <span class="bottomPrice">{{totalMoney}}</span> </view>
 
- 			<view class="bottomLeftLine2">总优惠:¥{{yhMoney}}</view>
 
- 		</view>
 
- 		<view class="bottomBtn commonBtn"  @click="submit">提交订单</view>
 
- 	</view>
 
- </view>
 
- </template>
 
- <script>
 
- 	export default {
 
- 		components: {
 
- 			
 
- 		},
 
- 		data() {
 
- 			return {
 
- 				userInfo:'',
 
- 				goodsnum:1,
 
- 				id:'',
 
- 				info:'',
 
- 				carInfo:'',
 
- 				shopID:'',
 
- 				shopName:'',
 
- 				goodsInfo:'',
 
- 				totalMoney:'',
 
- 				yhMoney:0,
 
- 				customerName:'',
 
- 				mobilePhone:'',
 
- 				comment:'',
 
- 				mydata:'',
 
- 				orderData:'',
 
- 				shareId:'',
 
- 				themeColor:'',
 
- 				isgo:true,
 
- 			}
 
- 		},
 
- 		onLoad(opt) {
 
- 			this.shopID=opt.shopID;
 
- 			this.shopName=opt.shopName;
 
- 			this.goodsnum=Number(opt.itemQty) ;
 
- 			if(opt.shareId){
 
- 				this.shareId=opt.shareId
 
- 			}
 
- 			//console.log(this.carInfo)
 
- 			this.themeColor = uni.getStorageSync("themeColor");
 
- 			this.userInfo = uni.getStorageSync("userInfo");
 
- 			this.goodsInfo=uni.getStorageSync("goodsDetail");
 
- 			this.jsMoney()
 
- 			//this.openGoodsDetailById()
 
- 			/* var a=[
 
- 				{name:1},{name:2}
 
- 			]
 
- 			var b=a.map(i=>i.name);
 
- 			console.log(b) */
 
- 			this.$http('openreservation/getInfo', {
 
- 				lat:  '',
 
- 				lng:'',
 
- 			}, 'GET').then(res => {
 
- 				this.mydata = res.data
 
- 			    this.mobilePhone=this.mydata.customerInfo.mobilePhone
 
- 			})
 
- 		},
 
- 		onShow() {
 
- 			this.carInfo=this.$store.state.carInfo;
 
- 		},
 
- 		methods: {
 
- 			submit(){
 
- 				if(this.carInfo){
 
- 					if(!this.carInfo.plateNumber){
 
- 						uni.showToast({
 
- 							title: '请选择车牌号',
 
- 							icon: 'none',
 
- 							duration: 3000
 
- 						});
 
- 						return false;
 
- 					}
 
- 					
 
- 				}
 
- 				if(!this.carInfo){
 
- 					if(!this.carInfo.plateNumber){
 
- 						uni.showToast({
 
- 							title: '请选择车牌号',
 
- 							icon: 'none',
 
- 							duration: 3000
 
- 						});
 
- 						return false;
 
- 					}
 
- 					uni.showToast({
 
- 						title: '请选择车辆',
 
- 						icon: 'none',
 
- 						duration: 3000
 
- 					});
 
- 					return false;
 
- 				}
 
- 				
 
- 				
 
- 				var jsonArray = [];
 
- 				var obj={
 
- 					itemId:this.goodsInfo.id,
 
- 					itemName:this.goodsInfo.name,
 
- 					itemQty:this.goodsnum,
 
- 					salePrice:this.goodsInfo.salePrice,
 
- 					totalPrice:this.totalMoney
 
- 				}
 
- 				jsonArray.push(obj)
 
- 				//"bizType:1商品2项目3套餐
 
- 				var params={
 
- 					sheetType:this.goodsInfo.bizType,
 
- 					sheetContent:this.goodsInfo.name,
 
- 					customerName:this.customerName,
 
- 					mobilePhone:this.mobilePhone,
 
- 					plateNumber:this.carInfo.plateNumber,
 
- 					carModel:this.carInfo.carModel,
 
- 					totalMoney:this.totalMoney,
 
- 					shopId:this.shopID,
 
- 					comment:this.comment,
 
- 					sheetDetail:JSON.stringify(jsonArray),
 
- 					shareId:this.shareId,
 
- 					groupType:0
 
- 				}
 
- 				if(!this.isgo){
 
- 					return false
 
- 				}
 
- 				 this.isgo=false;
 
- 				uni.showLoading({
 
- 					title: '加载中'
 
- 				})
 
- 				this.$http('openMallOrder/submitOrder', params,'POST').then(res => {
 
- 					uni.hideLoading();
 
- 					
 
- 					if(res.code==0){
 
- 						this.orderData=res.data
 
- 						this.unifiedPay(res.data)
 
- 					}else{
 
- 							this.isgo=true;
 
- 						uni.showToast({
 
- 							title: res.msg,
 
- 							icon: 'none',
 
- 							duration: 3000
 
- 						});
 
- 					}
 
- 				 })
 
- 			},
 
- 			unifiedPay(res){
 
- 				this.$http('openMallOrder/unifiedPay', {
 
- 					sheetId:res.id
 
- 				},'POST').then(res => {
 
- 					this.isgo=true;
 
- 					if(res.code==0){
 
- 						
 
- 						this.requestPayment(res.data)
 
- 					}else{
 
- 						uni.showToast({
 
- 							title: res.msg,
 
- 							icon: 'none',
 
- 							duration: 3000
 
- 						});
 
- 					}
 
- 				 })
 
- 			},
 
- 			requestPayment(res){
 
- 				var payInfo=res;
 
- 				//console.log(payInfo)
 
- 				//console.log(String(Date.now()))
 
- 				var that=this;
 
- 				uni.requestPayment({
 
- 					provider: 'wxpay',
 
- 					//timeStamp: String(Date.now()),
 
- 					timeStamp: payInfo.timeStamp,
 
- 					nonceStr: payInfo.nonceStr,
 
- 					package:payInfo.package,
 
- 					signType: payInfo.signType,
 
- 					paySign: payInfo.paySign,
 
- 					appid:payInfo.appId,	
 
- 					/* provider: 'wxpay',
 
- 					orderInfo:{
 
- 						"appid":payInfo.appid,  // 微信开放平台 - 应用 - AppId,注意和微信小程序、公众号 AppId 可能不一致
 
- 						"noncestr": payInfo.nonceStr, // 随机字符串
 
- 						 "package": "Sign=WXPay",         // 固定值
 
- 						"partnerid":payInfo.mchId,      // 微信支付商户号
 
- 						"prepayid": payInfo.prepayId, // 统一下单订单号 
 
- 						"timeStamp": String(Date.now()),      // 时间戳(单位:秒)
 
- 						"sign": payInfo.sign // 签名,这里用的 MD5/RSA 签名
 
- 					}, */
 
- 				    success: function (res) {
 
- 				        console.log('success:' + JSON.stringify(res));
 
- 						 uni.showToast({
 
- 							 title: '支付成功',
 
- 							 icon:'none',
 
- 							 duration: 2000
 
- 						 });
 
- 						  if((that.orderData.sheetType==1)||(that.orderData.sheetType==2)||(that.orderData.sheetType==3)){
 
- 						  	/* uni.redirectTo({
 
- 						  		url: "../user/myOrder/mallOrderDetail?id=" + that.orderData.id +"&SheetType=" + that.orderData.sheetType+'&sx=1'
 
- 						  	}) */
 
- 							uni.redirectTo({
 
- 								url:'../subPack/paySuccess?id=' + that.orderData.id +"&SheetType=" + that.orderData.sheetType+'&sx=1'+"&orderType=shop"
 
- 							})
 
- 						  }
 
- 						
 
- 				    },
 
- 				    fail: function (err) {
 
- 					  console.log(err)
 
- 				      uni.showToast({
 
- 						 title: '支付失败',
 
- 						 icon:'none',
 
- 						 duration: 2000
 
- 				      });
 
- 					  console.log(that.orderData)
 
- 					   if(that.orderData.sheetType==1||that.orderData.sheetType==2||that.orderData.sheetType==3){
 
- 						   console.log("商城订单s")
 
- 						/* uni.redirectTo({
 
- 							url: "../user/myOrder/mallOrderDetail?id=" + that.orderData.id +"&SheetType=" + that.orderData.sheetType
 
- 						}) */
 
- 						uni.navigateTo({
 
- 							url:'../subPack/paySuccess?id=' + that.orderData.id +"&SheetType=" + that.orderData.sheetType+'&sx=1'+"&orderType=shop"
 
- 						})
 
- 					   }
 
- 				    }
 
- 				}); 
 
- 			},
 
- 			openGoodsDetailById(){
 
- 				this.$http('openMall/openGoodsDetailById', {
 
- 				  id:this.id
 
- 				 },'GET').then(res => {
 
- 						this.info=res.data			
 
- 				 })
 
- 			},
 
- 			goINdex(){
 
- 				uni.switchTab({
 
- 					url:'../index/index'
 
- 				})
 
- 			},
 
- 			goCarlist(){
 
- 				uni.navigateTo({
 
- 					url:'../user/addCar/cailist'
 
- 				})
 
- 			},
 
- 			inputChange(){
 
- 				//console.log(this.goodsnum)
 
- 				if(this.goodsInfo.oneQty){
 
- 					if(this.goodsInfo.oneQty>this.goodsnum||this.goodsInfo.oneQty==this.goodsnum){
 
- 						
 
- 						this.jsMoney()
 
- 					}else{
 
- 						uni.showToast({
 
- 							 title: '超过限购次数',
 
- 							 icon:'none',
 
- 							 duration: 2000
 
- 						});
 
- 						this.goodsnum=this.goodsInfo.oneQty
 
- 						this.jsMoney()
 
- 					}
 
- 				}else{
 
- 					
 
- 					this.jsMoney()
 
- 				}
 
- 			},
 
- 			calculation(type){
 
- 				console.log(type)
 
- 				console.log(this.goodsnum)
 
- 				if(type==1){
 
- 					if(this.goodsnum>1){
 
- 						this.goodsnum--
 
- 						this.jsMoney()
 
- 					}
 
- 				}else{
 
- 					if(this.goodsInfo.oneQty){
 
- 						if(this.goodsInfo.oneQty>this.goodsnum){
 
- 							this.goodsnum++
 
- 							this.jsMoney()
 
- 						}
 
- 					}else{
 
- 						this.goodsnum++
 
- 						this.jsMoney()
 
- 					}
 
- 					
 
- 				}
 
- 			},
 
- 			jsMoney(){
 
- 				if(this.goodsInfo.salePrice){
 
- 					if(this.goodsInfo.categoryIds=='7B97D114-C419-42B2-9C1E-0B4CA284CDA0'){
 
- 						this.totalMoney=this.goodsInfo.salePrice*this.goodsnum*10000;
 
- 					}else{
 
- 						this.totalMoney=this.goodsInfo.salePrice*this.goodsnum
 
- 					}
 
- 					
 
- 					if(this.goodsInfo.scribingPrice){
 
- 						var wyh=this.goodsInfo.scribingPrice*this.goodsnum;
 
- 						this.yhMoney=wyh-this.totalMoney;
 
- 						console.log(this.yhMoney)
 
- 						this.yhMoney=this.yhMoney.toFixed(2)
 
- 					}else{
 
- 						this.yhMoney=0
 
- 					}
 
- 					this.totalMoney=this.totalMoney.toFixed(2)
 
- 				}else{
 
- 					this.totalMoney=this.goodsInfo.scribingPrice*this.goodsnum
 
- 					this.totalMoney=this.totalMoney.toFixed(2)
 
- 					this.yhMoney=0
 
- 				}
 
- 			}
 
- 			
 
- 		}
 
- 	}
 
- </script>
 
- <style scoped lang="less">
 
- .bottomBox{
 
- 	width: 750rpx;
 
- 	height: 120rpx;
 
- 	background: #FFFFFF;
 
- 	box-shadow: 0px -2px 10rpx 0px rgba(153,153,153,0.2000);
 
- 	display: flex;
 
- 	justify-content: space-between;
 
- 	position: fixed;
 
- 	left: 0;
 
- 	bottom: 0;
 
- }
 
- .bottomLeft{
 
- 	padding-top: 23rpx;
 
- 	padding-left: 30rpx;
 
- }
 
- .bottomLeftLine{
 
- 	color: #666666;
 
- 	font-size: 24rpx;
 
- }
 
- .bottomLeftLine span{
 
- 	color: #EC0F0A;
 
- }
 
- .bottomPrice{
 
- 	font-size: 32rpx;
 
- 	font-weight: 500;
 
- }
 
- .bottomLeftLine2{
 
- 	color: #999999;
 
- 	line-height: 33rpx;
 
- 	font-size: 24rpx;
 
- }
 
- .bottomBtn{
 
- 	width: 204rpx;
 
- 	height: 74rpx;
 
- 	background: #EC0F0A;
 
- 	border-radius: 37rpx;
 
- 	text-align: center;
 
- 	line-height: 74rpx;
 
- 	color: #FFFFFF;
 
- 	font-size: 30rpx;
 
- 	margin-top: 23rpx;
 
- 	margin-right: 30rpx;
 
- }
 
- .cont{
 
- 	padding: 20rpx 24rpx;
 
- }
 
- .contKk{
 
- 	background: #FFFFFF;border-radius: 10rpx;
 
- 	padding: 0 20rpx;
 
- }
 
- .contLine{
 
- 	display: flex;
 
- 	justify-content: space-between;
 
- 	font-size: 28rpx;
 
- 	padding: 30rpx 0;
 
- 	border-bottom: 1px solid #EEEEEE;
 
- }
 
- .contLine2{
 
- 	font-size: 28rpx;
 
- 	padding: 30rpx 0;
 
- }
 
- .contlineLeft{
 
- 	color: #666666;
 
- 	line-height: 40rpx;
 
- 	
 
- }
 
- .carModel{
 
- 	    width: 400rpx;
 
- 	    display: inline-block;
 
- 		white-space: nowrap;
 
- 		overflow: hidden;
 
- 		text-overflow: ellipsis;
 
- }
 
- .carModelRight{
 
- 	display: flex;justify-content: space-between;
 
- }
 
- .contlineRight{
 
- 	color: #333333;
 
- 	line-height: 40rpx;
 
- 	white-space: nowrap;
 
- 	overflow: hidden;
 
- 	text-overflow: ellipsis;
 
- 	width: 500rpx;
 
- 	text-align: right;
 
- }
 
- .contlineRight2{
 
- 	color: #333333;
 
- 	line-height: 40rpx;
 
- 	width: 550rpx;
 
- 	text-align: right;
 
- }
 
- .contlineRightInput{
 
- 	color: #333333;
 
- }
 
- .contlineRightJt{
 
- 	width: 12rpx;
 
- 	height: 20rpx;
 
- 	margin-left: 20rpx;
 
- 	margin-top: 10rpx;
 
- }
 
- .box{
 
- 	background: #F4F5F7;
 
- 	min-height: 100vh;
 
- }
 
- .topBox{
 
- 	height: 140rpx;
 
- 	background: #EC0F0A;
 
- 	width: 750rpx;
 
- }
 
- .yuanhu{
 
- 	width: 750rpx;
 
- 	height: 30rpx;
 
- 	background: #EC0F0A;
 
- 	border-radius: 0 0 100% 100%;
 
- }
 
- .goodsBox{
 
- 	width: 662rpx;
 
- 	height: 194rpx;
 
- 	background: #FFFFFF;
 
- 	border-radius: 16rpx;
 
- 	margin-left: 24rpx;
 
- 	margin-top: -100rpx;
 
- 	padding: 20rpx;
 
- 	display: flex;
 
- }
 
- .goodsBoxLeft{
 
- 	width: 208rpx;
 
- 	height: 194rpx;
 
- 	border-radius: 16rpx;
 
- 	border: 1px solid #EEEEEE;
 
- }
 
- .hotGoodsLineImg{
 
- 	width: 208rpx;
 
- 	height: 194rpx;
 
- }
 
- .goodsnum{
 
- 	width: 88rpx;
 
- 	height: 44rpx;
 
- 	background: #F4F5F7;
 
- 	line-height: 44rpx;
 
- 	text-align: center;
 
- 	font-weight: 500;
 
- 	color: #333333;
 
- 	font-size: 24rpx;
 
- 	margin: 0 4rpx;
 
- }
 
- .goodsnumInput{
 
- 	width: 80rpx;
 
- 	height: 44rpx;
 
- 	background: #F4F5F7;
 
- 	line-height: 44rpx;
 
- 	text-align: center;
 
- 	font-weight: 500;
 
- 	color: #333333;
 
- 	font-size: 24rpx;
 
- }
 
- .numJsbox{
 
- 	display: flex;
 
- }
 
- .numJj{
 
- 	width: 60rpx;
 
- 	height: 44rpx;
 
- 	background: #F4F5F7;
 
- 	border-radius: 0px 6rpx 6rpx 0px;	
 
- 	text-align: center;
 
- 	line-height: 44rpx;
 
- 	font-size: 32rpx;
 
- 	color: #999999;
 
- }
 
- .goodsnum{
 
- 	width: 80rpx;
 
- 	height: 44rpx;
 
- 	background: #F4F5F7;
 
- 	line-height: 44rpx;
 
- 	text-align: center;
 
- 	font-weight: 500;
 
- 	color: #333333;
 
- 	font-size: 24rpx;
 
- 	margin: 0 4rpx;
 
- }
 
- .goodsBottom{
 
- 	display: flex;
 
- 	justify-content: space-between;
 
- 	padding-top: 60rpx;
 
- }
 
- .goodsPrice{
 
- 	color: #333333;
 
- 	font-size: 32rpx;
 
- 	font-weight: 500;
 
- }
 
- .goodsPrice1{
 
- 	color: #333333;
 
- 	font-size: 22rpx;
 
- }
 
- .goodsName{
 
- 	font-weight: 400;
 
- 	color: #333333;
 
- 	line-height: 40rpx;
 
- 	font-size: 28rpx;
 
- 	height: 80rpx;
 
- 	text-overflow: -o-ellipsis-lastline;
 
- 	overflow: hidden;				
 
- 	text-overflow: ellipsis;		
 
- 	display: -webkit-box;			
 
- 	-webkit-line-clamp: 2;		
 
- 	line-clamp: 2;					
 
- 	-webkit-box-orient: vertical;
 
- 	width: 420rpx;
 
- }
 
- .goodsBoxRgiht{
 
- 	padding-left: 24rpx;
 
- 	
 
- }
 
- .carModelCK{
 
- 	font-weight: 400;
 
- 	font-size: 24rpx;
 
- 	color: #666666;
 
- 	width: 550rpx;
 
- 	white-space: nowrap;
 
- 	overflow: hidden;
 
- 	text-overflow: ellipsis;
 
- }
 
- </style>
 
 
  |