lhl 2 سال پیش
والد
کامیت
ac322d924e
2فایلهای تغییر یافته به همراه67 افزوده شده و 24 حذف شده
  1. 5 5
      api/model.js
  2. 62 19
      pages/user/model/model.vue

+ 5 - 5
api/model.js

@@ -3,7 +3,7 @@ import request from '@/utils/request'
 export function getCommonUserCardInfo(data) {
 	return request({
 		url: '/api/pub/getCommonUserCardInfo',
-		method: 'get',
+		method: 'post',
 		data
 	});
 }
@@ -11,7 +11,7 @@ export function getCommonUserCardInfo(data) {
 export function getShowTemplateItem(data) {
 	return request({
 		url: '/api/pub/getShowTemplateItem',
-		method: 'get',
+		method: 'post',
 		data
 	});
 }
@@ -19,8 +19,8 @@ export function getShowTemplateItem(data) {
 //购买皮肤模板
 export function subShowTemplateOrder(data) {
 	return request({
-		url: '/api/pub/getShowTemplateItem',
-		method: 'get',
+		url: '/api/user/subShowTemplateOrder',
+		method: 'post',
 		data
 	});
 }
@@ -94,7 +94,7 @@ export function userShowTemplateList(data) {
 export function getUserCardInfo(data, id) {
 	return request({
 		url: '/api/user/getUserCardInfo',
-		method: 'get',
+		method: 'post',
 		data
 	});
 }

+ 62 - 19
pages/user/model/model.vue

@@ -1,5 +1,5 @@
 <template>
-	<view class="content" :class="mtype==1?'mone':'mbase'" v-if="baseURL">
+	<view class="content mone" v-if="baseURL">
 		<view class="m-top">
 			<image :src="baseURL + '/resource/icon/model1/top-base.png'" mode="" class="top-bg"></image>
 			<image :src="baseURL + '/resource/icon/model1/resume.png'" mode="" class="readme"></image>
@@ -53,7 +53,8 @@
 								<text style="flex-shrink: 0;">服务地区:</text>
 								<view class="fwdz flex">
 									<view v-for="(fwitem,fwindex) in cardInfo.service_area_all">
-										{{fwitem}}{{fwindex ==(cardInfo.service_area_all.length -1) ?'': '、'  }}</view>
+										{{fwitem}}{{fwindex ==(cardInfo.service_area_all.length -1) ?'': '、'  }}
+									</view>
 								</view>
 							</view>
 							<view class="info-item-q flex" style="align-items: flex-start;">
@@ -61,10 +62,10 @@
 								<view class="gzt">
 									<image :src="baseURL + '/resource/icon/model1/tiao.png'" mode=""></image>
 									<view class="gzt-price">
-										<text>{{cardInfo.service_min_price}}</text>元/{{cardInfo.service_time_type_title.replace('每','')}}
+										<text>{{cardInfo.service_min_price}}</text>元/{{ cardInfo.service_time_type_title && cardInfo.service_time_type_title.replace('每','')}}
 									</view>
 									<view class=" gzt-price-b">
-										<text>{{cardInfo.service_max_price}}</text>元/{{cardInfo.service_time_type_title.replace('每','')}}
+										<text>{{cardInfo.service_max_price}}</text>元/{{cardInfo.service_time_type_title && cardInfo.service_time_type_title.replace('每','')}}
 									</view>
 								</view>
 								<image :src="baseURL + '/resource/icon/model1/yrz.png'" mode="" class="rz"></image>
@@ -165,7 +166,8 @@
 	import {
 		getUserCardInfo,
 		getCommonUserCardInfo,
-		getShowTemplateItem
+		getShowTemplateItem,
+		subShowTemplateOrder
 	} from '@/api/model.js'
 	export default {
 		data() {
@@ -173,27 +175,28 @@
 				mtype: 1,
 				shareId: '',
 				cardInfo: {},
-				modelInfo: {}
+				modelInfo: {},
+				payType: 'wxpay'
 			}
 		},
 		computed: {
 			...mapState(['baseURL']),
-			...mapState('user',['userInfo'])
+			...mapState('user', ['userInfo'])
 		},
 		onLoad(opt) {
 			// this.getUserCardInfo()
-			opt.mtype = opt.mtype
-			if(opt.uid) {
+			this.mtype = opt.mtype
+			if (opt.uid) {
 				this.shareId = opt.uid
 				this.getCommonUserCardInfo(opt.uid)
-			}else {
+			} else {
 				this.getUserCardInfo()
 				this.getShowTemplateItem()
 			}
-			
+
 		},
 		onShow() {
-			
+
 		},
 		onShareAppMessage(options) {
 			// 设置菜单中的转发按钮触发转发事件时的转发内容
@@ -227,23 +230,57 @@
 				let that = this
 				subShowTemplateOrder({
 					id: that.mtype,
-					pay_type: 'wxpay'
+					pay_type: that.payType
 				}).then(res => {
-					
+					let da = res.data.jsApiParameters;
+					let data = {
+						appId: da.appId,
+						// #ifdef H5
+						timestamp: da.timeStamp,
+						// #endif
+						// #ifdef MP
+						timeStamp: da.timeStamp + '',
+						// #endif
+						nonceStr: da.nonceStr,
+						package: da.package,
+						signType: da.signType,
+						paySign: da.paySign,
+						success: function(res) {
+							// obj.paySuccessTo();
+							// alert('支付成功')
+							console.log('支付成功')
+						},
+						fail: (err) => {
+							console.log(err)
+							// alert('支付失败')
+							// uni.navigateTo({
+							// 	url: '/pages/order/order?state=0'
+							// });
+						}
+					};
+					console.log(data, 'timeStamp')
+					if (that.payType == 'wxpay') {
+						console.log('到这里')
+						wx.requestPayment(data)
+						
+
+
+
+					}
 				})
 			},
 			getShowTemplateItem() {
 				let that = this
 				getShowTemplateItem({
 					id: that.mtype
-				}).then(res=> {
+				}).then(res => {
 					that.modelInfo = res.data
 				})
 			},
 			getCommonUserCardInfo(uid) {
 				let that = this
 				getCommonUserCardInfo({
-					uid:uid
+					uid: uid
 				}).then(res => {
 					let arr = []
 					let basearr = res.data.service_area_all
@@ -687,7 +724,7 @@
 		}
 	}
 
-	
+
 	.fxmp {
 		position: fixed;
 		width: 750rpx;
@@ -705,6 +742,7 @@
 			line-height: 78rpx;
 		}
 	}
+
 	.create-model {
 		position: fixed;
 		width: 750rpx;
@@ -714,19 +752,23 @@
 		font-weight: 500;
 		text-align: center;
 		line-height: 98rpx;
+
 		.price-show {
 			font-size: 32rpx;
 			font-weight: 500;
 			color: #333333;
 			background-color: #fff;
 			flex-grow: 1;
+
 			text {
 				font-size: 48rpx;
 				font-weight: 500;
 				color: #FC6F6D;
 			}
 		}
-		.to-show, .by-now{
+
+		.to-show,
+		.by-now {
 			width: 223rpx;
 			height: 98rpx;
 			background: #fa98b6;
@@ -734,8 +776,9 @@
 			font-size: 34rpx;
 			color: #fff;
 		}
+
 		.by-now {
-			background:#f65486;
+			background: #f65486;
 		}
 	}
 </style>