lhl 1 year ago
parent
commit
98f7667202
2 changed files with 191 additions and 23 deletions
  1. 27 2
      api/model.js
  2. 164 21
      pages/user/model/model.vue

+ 27 - 2
api/model.js

@@ -1,4 +1,29 @@
-import request from '@/utils/request'
+import request from '@/utils/request'
+//获取其他用户名片信息
+export function getCommonUserCardInfo(data) {
+	return request({
+		url: '/api/pub/getCommonUserCardInfo',
+		method: 'get',
+		data
+	});
+}
+//获取模板详情
+export function getShowTemplateItem(data) {
+	return request({
+		url: '/api/pub/getShowTemplateItem',
+		method: 'get',
+		data
+	});
+}
+
+//购买皮肤模板
+export function subShowTemplateOrder(data) {
+	return request({
+		url: '/api/pub/getShowTemplateItem',
+		method: 'get',
+		data
+	});
+}
 // 获取服务时间类型
 export function getServiceTimeTypeList(data) {
 	return request({
@@ -57,7 +82,7 @@ export function getShowTemplateList(data) {
 })
 }
 
-
+//获取本人用户名片信息
 export function getUserCardInfo(data, id) {
 	return request({
 		url: '/api/user/getUserCardInfo',

+ 164 - 21
pages/user/model/model.vue

@@ -10,9 +10,9 @@
 			<view class="user-name">
 				{{cardInfo.name || '詹继红'}}
 			</view>
-			<button type="default" class="fx-btn">
+			<!-- <button type="default" class="fx-btn">
 				<image :src="baseURL + '/resource/icon/model1/fx.png'" mode=""></image>
-			</button>
+			</button> -->
 		</view>
 		<view class="m-body gr">
 			<!-- 个人信息 -->
@@ -50,7 +50,11 @@
 								综 <text class="laner"></text> 合<text class="laner"></text>分: 50
 							</view> -->
 							<view class="info-item-q flex" style="align-items: flex-start;">
-								<text style="flex-shrink: 0;">服务地区: </text><text>椒江区、黄岩区、路桥区</text>
+								<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>
+								</view>
 							</view>
 							<view class="info-item-q flex" style="align-items: flex-start;">
 								<text style="flex-shrink: 0;">服务价格: </text>
@@ -134,8 +138,21 @@
 		</view>
 		<view class="create-model-ts">
 		</view>
-		<view class="create-model">
-			生成我的专属简历
+		<button type="default" class="fxmp" open-type="share" v-if="!shareId && modelInfo.is_use== 1">
+			<view class="">
+				分享名片
+			</view>
+		</button>
+		<view class="create-model flex" v-if="!shareId && modelInfo.is_use== 0">
+			<view class="price-show">
+				模板费用:<text>{{modelInfo.price*1}}</text>
+			</view>
+			<view class="to-show">
+				模板预览
+			</view>
+			<view class="by-now" @click="gobuy">
+				购买使用
+			</view>
 		</view>
 	</view>
 </template>
@@ -145,32 +162,108 @@
 		mapState,
 		mapMutations
 	} from 'vuex';
-
 	import {
-		getUserCardInfo
+		getUserCardInfo,
+		getCommonUserCardInfo,
+		getShowTemplateItem
 	} from '@/api/model.js'
 	export default {
 		data() {
 			return {
 				mtype: 1,
-				cardInfo: {}
+				shareId: '',
+				cardInfo: {},
+				modelInfo: {}
 			}
 		},
 		computed: {
-			...mapState(['baseURL'])
+			...mapState(['baseURL']),
+			...mapState('user',['userInfo'])
 		},
-		onLoad() {
-			console.log(this.$store.state.baseURL)
-			this.getUserCardInfo()
+		onLoad(opt) {
+			// this.getUserCardInfo()
+			opt.mtype = opt.mtype
+			if(opt.uid) {
+				this.shareId = opt.uid
+				this.getCommonUserCardInfo(opt.uid)
+			}else {
+				this.getUserCardInfo()
+				this.getShowTemplateItem()
+			}
+			
 		},
 		onShow() {
-
+			
+		},
+		onShareAppMessage(options) {
+			// 设置菜单中的转发按钮触发转发事件时的转发内容
+			let pages = getCurrentPages(); //获取加载的页面
+			let currentPage = pages[pages.length - 1]; //获取当前页面的对象
+			let url = currentPage.route; //当前页面url
+			let item = currentPage.options; //如果要获取url中所带的参数可以查看options
+			let shareObj = {}
+			shareObj = {
+				title: '母婴界', // 默认是小程序的名称(可以写slogan等)
+				path: url + '?uid=' + this.userInfo.uid + '&mtype=' + this.mtype, // 默认是当前页面,必须是以‘/’开头的完整路径
+				imageUrl: '',
+				success: function(res) {
+					// 转发成功之后的回调
+					if (res.errMsg == 'shareAppMessage:ok') {}
+				},
+				fail: function() {
+					// 转发失败之后的回调
+					if (res.errMsg == 'shareAppMessage:fail cancel') {
+						// 用户取消转发
+					} else if (res.errMsg == 'shareAppMessage:fail') {
+						// 转发失败,其中 detail message 为详细失败信息
+					}
+				}
+			};
+			console.log(shareObj)
+			return shareObj;
 		},
 		methods: {
+			gobuy() {
+				let that = this
+				subShowTemplateOrder({
+					id: that.mtype,
+					pay_type: 'wxpay'
+				}).then(res => {
+					
+				})
+			},
+			getShowTemplateItem() {
+				let that = this
+				getShowTemplateItem({
+					id: that.mtype
+				}).then(res=> {
+					that.modelInfo = res.data
+				})
+			},
+			getCommonUserCardInfo(uid) {
+				let that = this
+				getCommonUserCardInfo({
+					uid:uid
+				}).then(res => {
+					let arr = []
+					let basearr = res.data.service_area_all
+					basearr.forEach(item => {
+						arr.push(item[0].name + item[1].name + item[2].name)
+					})
+					res.data.service_area_all = arr
+					that.cardInfo = res.data
+				})
+			},
 			getUserCardInfo() {
 				let that = this
 				getUserCardInfo().then(res => {
 					console.log(res)
+					let arr = []
+					let basearr = res.data.service_area_all
+					basearr.forEach(item => {
+						arr.push(item[0].name + item[1].name + item[2].name)
+					})
+					res.data.service_area_all = arr
 					that.cardInfo = res.data
 				})
 			}
@@ -432,6 +525,11 @@
 				align-items: flex-start;
 				justify-content: start;
 
+				.fwdz {
+					flex-direction: column;
+					align-items: flex-start;
+				}
+
 				.gzt {
 					width: 312rpx;
 					height: 24rpx;
@@ -581,18 +679,63 @@
 		height: 30rpx;
 	}
 
-	.create-model {
+	.fxmp {
+		padding: 0;
+
+		&::after {
+			border: none;
+		}
+	}
+
+	
+	.fxmp {
+		position: fixed;
 		width: 750rpx;
 		height: 78rpx;
-		background: #f65486;
-		border-radius: 5rpx;
-		font-size: 30rpx;
-		font-weight: 500;
-		color: #FFFFFF;
-		text-align: center;
-		line-height: 78rpx;
+		bottom: 0;
+		padding: 0;
 
+		view {
+			background: #f65486;
+			border-radius: 5rpx;
+			font-size: 30rpx;
+			font-weight: 500;
+			color: #FFFFFF;
+			text-align: center;
+			line-height: 78rpx;
+		}
+	}
+	.create-model {
 		position: fixed;
+		width: 750rpx;
 		bottom: 0;
+		border-radius: 5rpx;
+		font-size: 32rpx;
+		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{
+			width: 223rpx;
+			height: 98rpx;
+			background: #fa98b6;
+			flex-shrink: 0;
+			font-size: 34rpx;
+			color: #fff;
+		}
+		.by-now {
+			background:#f65486;
+		}
 	}
 </style>