<template>
	<view class="container">
		<!-- 轮播图 -->
		<top-swiper :imgList="imgList"></top-swiper>
		<!-- 标题 -->
		<view class="introduce-section">
			<text class="title clamp2">{{ goodsObjact.store_name }}</text>
			<view class="price-box">
				<view class="price">
					{{ (list.integral*1).toFixed(2) }}<text class="price-tip">积分</text>
					<text class="text">/份</text>
				</view>
			</view>
			<view class="bot-row">
			    <text>快递: {{ goodsObjact.express_fee }}</text>
			    <text style="text-align: left;">已售: {{ goodsObjact.fsales }}</text>
			    <!-- <text style="text-align: right;">{{ storeObjact.address | address }}</text> -->
			</view>
		</view>
		<estimate @navTo="navTo('/pages/product/reply?id=' + goodsid)" v-if="reply" :reply="reply" :list="list"></estimate>
		<!-- 规格信息 -->
		<fresh-detail :goodsObjact="goodsObjact"></fresh-detail>
		<!-- 图文详情 -->
		<content-text :description="description"></content-text>
		<!-- 底部高度撑开 -->
		<view class="contentBottomHeight" style="background:#fff;"></view>
		<!-- 底部操作菜单 -->
		<view class="contentBottomHeight" style="position: fixed;bottom: 0rpx;" @click="specOPne(1)">
			立即兑换
		</view>
		<!-- <product-bottom v-if="goodsObjact.id" @buy="buy" :goodsObjact="goodsObjact" :goodsid="goodsid" @specOPne="specOPne"></product-bottom> -->
		<!-- 规格-模态层弹窗 -->
		<view class="popup spec" :class="specClass" @touchmove.stop.prevent="stopPrevent" @click="toggleSpec">
			<!-- 遮罩层 -->
			<view class="mask"></view>
			<view class="layer attr-content" @click.stop="stopPrevent">
				<view class="a-t">
					<image :src="actionImage"></image>
					<view class="right">
						<view class="good-name clamp">{{ goodsObjact.store_name }}</view>
						<text class="price">¥{{ actionPrice }}</text>
						<!-- <text class="stock">库存：{{ goodsObjact.stock }}件</text> -->
						<!-- <view class="selected" v-if="goodsType == 0">
							已选：
							<text class="selected-text" v-for="(sItem, sIndex) in specSelected" :key="sIndex">{{ sItem }}</text>
						</view> -->
					</view>
				</view>
				<view v-for="(item, index) in specList" :key="index" class="attr-list">
					<text>{{ item.attr_name }}</text>
					<view class="item-list">
						<text v-for="(childItem, childIndex) in item.attr_value" :key="childIndex" class="tit"
							:class="{ selected: childItem.check }" @click="selectSpec(childItem, item, index)">
							{{ childItem.attr }}
						</text>
					</view>
				</view>
				<view class="flex">
					<view>购买数量</view>
					<view class="item-list">
						<uni-number-box class="step" :isMin="true" :value="goodsNumber" :min="1" :max="goodsNumberMax"
							@eventChange="numberChange"></uni-number-box>
					</view>
				</view>
				<button class="btn" @click.stop="gobuy">确定</button>
			</view>
		</view>
	</view>
</template>

<script>
import { goodsDetail, cartAdd, getJfDetail, getBl } from '@/api/product.js';
import { jfOrderCreate } from '@/api/order.js'
import { mapState,mapMutations } from 'vuex';
import store from '@/store/index.js';
import { saveUrl } from '@/utils/loginUtils.js';
import { getUserInfo } from '@/api/user.js'
import uniNumberBox from '@/components/uni-number-box.vue';
// #ifdef H5
import { weixindata } from '@/utils/wxAuthorized';
// #endif
// 头部轮播图
import topSwiper from './common/topSwiper.vue';
// 标题
import productContent from './common/productContent.vue';
// 到货时间及优惠
import discounts from './common/discounts.vue';
// 规格信息
import freshDetail from './common/freshDetail.vue';
// 图文详情
import contentText from './common/contentText.vue';
// 底部按钮
import productBottom from './common/productBottom.vue';
// 猜你喜欢
import guessLike from './common/guessLike.vue';
// 评价
import estimate from './common/estimate.vue';
export default {
	components: {
		guessLike,
		topSwiper,
		productContent,
		discounts,
		freshDetail,
		contentText,
		productBottom,
		estimate,
		uniNumberBox
	},
	data() {
		return {
			specLList: [],
			loaded: true,
			addressImg:
				'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAu4AAAAFCAYAAAAaAWmiAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0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PRnz6B/u4t9I+U9cYCH81hddoFuBG4bxNq7v9xSfh+G/H9wKkIwF5JkR38fF3VLb73dDXhpsYS8P0Vxve7MZ14E04EkX2SumDj40Lkjz2LS9x1nZVqcK1rh1L/GaiZDB1GYwGPRi9+sA4r63odGEjAoKTZS0mTwUtoS2sTPioc1jd64KJqNZXRP9EtLFrLT5KQOd6H1JtvQ/SUQ1CUC1Z/tjp5MgXn51bAfc1VpAUVb6pqi+bsqRlrOB0ITSI0kUa1IvF7JcribPbxZnt9BYIeBZm0ap1BO2yHLMOIxjH111chmDocXg9XzZFR4fD74e5cA9GtQEulbLGbfaNMvv4+BfG3hiet9wxlUeDGdDPn68uqXVgVKKezbiBN/HHYoTnrqlORkDx0BHr/ABzVVbknbZysZ3wnRVyda6HU1UIjvpt28p2C+T+GEtYeeEh3jqcdKjl2BcWY65q9UAQb+c6+k3iePnaS+P5Pq8spOJ38fJ09RVI1OFuWo6xtJXSD+J6xh++OHN8PEt8HxtNY4pbAczC+m2Rnh8V3J9Q0Fa4LeG97YQdehj4aoSL9NZiZNMTKStp6g5/x5NsW37vWQaS1WXzPHvjihzYS/lgshbeJ75WySHm7wNXXk8SbK/xutOX4ntHtYRxE0eJn6uARaGf6ie++7GPNxVkf/78AAwCn1+RYqusbZQAAAABJRU5ErkJggg==',
			// 当前选中的支付方式
			addressData: {},
			goodsStore: 0, //选中库存
			specList: [],
			buys_show: true,
			buys_shows: false,
			specSelected: [], //选中的分类
			specClass: 'none', //显示隐藏弹窗
			many: 1, //1是单规格  2是多规格
			reply: '', //评论
			list: '', //商品详情的数据
			type: 1, //默认支付方式add为
			goodsType: 0,
			goodsNumber: 1, //购买数量
			goodsid: '', //商品id
			description: '', //商品描述
			goodsObjact: {
				percent: 1
			}, //保存商品数据
			//图片循环
			imgList: [],
			// 对比对象
			actionPrice: 0, //默认选中商品价格
			actionImage: '', //默认选中图片
			good_list: '', //猜你喜欢列表
			goodsNumberMax: 0, //最大可购买数量
			// 倒计时数据保存
			seckillObj: {
				stopTime: 0, //结束时间
				stop: false, //是否结束
				stopTimeH: 0, //小时
				stopTimeM: 0, //分钟
				stopTimeS: 0, //秒钟
				stopTimeD: 0, //天
				upTime: 0 //更新组件内部组件用
			},
			// 拼团数据保存
			pink: {
				id: '', //拼团编号
				uid: '', //用户编号
				people: '', //拼团人数
				price: '', //拼团价格
				stop_time: '', //拼团结束时间
				nickname: '', //团长昵称
				avatar: '', //团长头像
				count: '', //拼团剩余人数
				h: '', //时
				i: '', //分
				s: '' //秒
			},
			userInfo: '',
			three_integral: 1,
		};
	},
	filters: {
		parseIntTo(percent) {
			percent = +percent * 100;
			if (percent % 1 === 0) {
				return percent;
			} else {
				percent = percent.toFixed(1);
				return percent;
			}
		}
	},
	async onLoad(options) {
		let obj = this;
		obj.getBl()
		obj.userInfo = uni.getStorageSync('userInfo');
		//保存商品id
		console.log(options);
		this.goodsid = options.id;
		this.goodsType = options.type;
		// 判断有无人邀请
		if (options.spread) {
			// 存储邀请人
			uni.setStorageSync('spread', options.spread);
		}
		saveUrl();
		this.goodsDetail();
		// 注册邀请信息
		// #ifdef H5
		let bool = uni.getStorageSync('weichatBrowser') || '';
		if (bool) {
			weixindata();
		}
		// #endif
	},
	computed: {
		...mapState(['weichatObj', 'baseURL', 'urlFile'])
	},
	// 分享
	onShareAppMessage(options) {
		// 设置菜单中的转发按钮触发转发事件时的转发内容
		let pages = getCurrentPages(); //获取加载的页面
		let currentPage = pages[pages.length - 1]; //获取当前页面的对象
		let url = currentPage.route; //当前页面url
		let item = currentPage.options; //如果要获取url中所带的参数可以查看options
		let shareObj = {
			title: this.goodsObjact.store_name + '   价格：' + this.goodsObjact.price, // 默认是小程序的名称(可以写slogan等)
			path: url + '?id=' + item.id + '&spread=' + this.userInfo.uid, // 默认是当前页面，必须是以‘/’开头的完整路径
			imageUrl: this.goodsObjact.image,
			success: function(res) {
				// 转发成功之后的回调
				if (res.errMsg == 'shareAppMessage:ok') {
				}
			},
			fail: function() {
				// 转发失败之后的回调
				if (res.errMsg == 'shareAppMessage:fail cancel') {
					// 用户取消转发
				} else if (res.errMsg == 'shareAppMessage:fail') {
					// 转发失败，其中 detail message 为详细失败信息
				}
			}
		};

		return shareObj;
	},
	methods: {
		...mapMutations('user',['setUserInfo']),
		getBl(){
			let obj = this
			getBl().then(res => {
				console.log(res,'res')
				obj.three_integral = res.data.three_integral
				console.log(obj.three_integral)
			})
		},
		numberChange(e){
			this.goodsNumber = e.number;
		},
		//选择规格
		selectSpec(item, arr, ind) {
			let obj = this;
			console.log(item, arr, ind)
			arr.item.forEach(function(e) {
				e.check = false;
			});
			obj.loaded = false
			item.check = true;
			obj.loaded = true
			console.log(item,arr,'item+9+++')
			
			obj.specSelected[ind] = item.id;
			let str = obj.specSelected.join('_');
			console.log(str,'str')
			let chooseGood = obj.specLList[str]
			console.log(chooseGood,'price++++++++++++++++')
			// // 获取当前选中的对象
			// if (obj.productValue[str]) {
			// 	obj.buys_show = true;
			// 	obj.buys_shows = false;
			// 	obj.actionPrice = obj.productValue[str].price;
			// 	obj.goodsNumberMax = obj.productValue[str].stock;
			// 	obj.actionImage = obj.productValue[str].image;
			// 	obj.uniqueId = obj.productValue[str].unique;
			// 	obj.goodsStore = obj.productValue[str].stock;
			// } else {
			// 	(obj.buys_show = false), (obj.buys_shows = true);
			// }
			// if (obj.goodsStore == 0) {
			// 	obj.buys_show = false;
			// 	obj.buys_shows = true;
			// }
			// obj.specSelected[ind] = item.id;
			console.log(obj.specSelected,'obj.specSelected++++++')
			obj.actionPrice = chooseGood.price
			obj.actionImage = chooseGood.image || obj.goodsObjact.image[0].url; //保存默认选中商品图片
			console.log(obj.actionPrice,'obj.actionPrice++++++')
		},
		// 打開彈窗
		specOPne(type = 1) {
			let obj = this;
			obj.specClass = 'show';
			obj.type = type;
		},
		//规格弹窗开关
		toggleSpec(str) {
			if (this.specClass === 'show') {
				this.specClass = 'hide';
				setTimeout(() => {
					this.specClass = 'none';
				}, 250);
			} else if (this.specClass === 'none') {
				this.specClass = 'show';
			}
			// 保存当前购买类型
			this.type = str;
		},
		//领取优惠券
		Getcoupon() {
			uni.navigateTo({
				url: '/pages/coupon/getcoupon'
			});
		},
		//详情页
		navToDetailPage(item) {
			let id = item.id;
			uni.navigateTo({
				url: '/pages/product/product?id=' + id
			});
		},
		// 跳转页面
		navTo(url) {
			uni.navigateTo({
				url: '/pages/product/reply?id=' + this.goodsid
			});
		},
		//加入购物车
		Addcar(item) {
			let obj = this;
			let data  = {
				cartNum: '1', //商品数量
				uniqueId: '', //商品标签
				new: 0, //商品是否新增加到购物车1为不加入0为加入
				mer_id: '',
				productId: item.id //商品编号
			}
			cartAdd(data)
				.then(function(e) {
					uni.showToast({
						title: '成功加入购物车',
						type: 'top',
						duration: 500,
						icon: 'none'
					});

					obj.goodsDetail();
				})
				.catch(e => {
					console.log(e);
				});
		},
		goodsDetail() {
			let obj = this;
			console.log(obj.goodsid,'obj.goodsid')
			// getJfDetail({id: obj.goodsid}).then(res => {
			// 	console.log(res)
			// })
			// 获取普通商品信息
			goodsDetail({},obj.goodsid).then(function({data}) {console.log(data,'eeeee');
				obj.list = data;
				console.log(obj.list,'list');
				obj.good_list = data.good_list; //保存猜你喜欢列表
				obj.reply = data.reply; //保存评论列表
				let goods = data.storeInfo;
				obj.goodsObjact = goods;
				console.log(goods,'goods');
				// console.log(goods.productAttr[0].length ,'21312321');
				console.log('21312321');
				if (obj.goodsObjact.description != null) {
					obj.description = obj.goodsObjact.description.replace(/\<img/gi, '<img class="rich-img"');
				} //小程序商品详情图超出屏幕问题
				obj.imgList = goods.slider_image.map(item => {return item}); //保存轮播图
				console.log(obj.imgList);
				
				// if(goods.productAttr[0].length > 0) {
				// 	obj.specList = goods.productAttr; //保存分类列表
				// 	obj.specLList = goods.spec
				// 	for (let i = 0; i < obj.specList.length; i++) {
				// 		// 设置默认数据
				// 		let attrValue = obj.specList[i].item[0];
				// 		attrValue.check = true;
				// 		obj.specSelected.push(attrValue.id);
				// 		console.log(obj.specSelected,'obj.specSelected')
				// 		// obj.actionImage = goods.image[0].url; //保存默认选中商品图片
				// 	}
				// 	let str = obj.specSelected.join('_');
				// 	let chooseGood = obj.specLList[str]
				// 	obj.actionPrice = chooseGood.price
				// 	obj.actionImage = chooseGood.image || obj.goodsObjact.image[0].url; //保存默认选中商品图片
					
				// }else {
				// 	obj.actionPrice = goods.price; //保存默认选中商品价格
				// 	obj.actionImage = goods.image[0].url; //保存默认选中商品图片
				// 	obj.goodsNumberMax = 1; //保存默认选中最大可购买商品数量
				// }
				
				// if()
				obj.productValue = data.productValue; //保存分类查询数据
				
			});
		},
		// 立即购买
		buy() {
			let obj = this;
			// 创建传值对象
			let data = {
				cartNum: obj.goodsNumber, //商品数量
				new: 1,
				productId: obj.goodsid, //商品编号
				uniqueId: obj.uniqueId
			};

			if (obj.type == 2) {
				data.new = 0;
			}
			if(obj.goodsObjact.is_gp==1){
				data.is_gp = 1;
			}
			cartAdd(data)
				.then(function(e) {
					let da = e.data;
					if (obj.type == 1) {
						// 跳转到支付页
						let url =  '/pages/order/createOrder?id=' + da.cartId;
						if(obj.goodsObjact.is_gp==1){
							data.is_gp = 1;
							url+=`&is_gp=1`
						}
						uni.navigateTo({
							url
						});
					}
					if (obj.type == 2) {
						uni.showToast({
							title: '成功加入购物车',
							type: 'top',
							duration: 2000,
							icon: 'none'
						});
						obj.goodsDetail();
					}
					obj.toggleSpec();
				})
				.catch(e => {
					console.log(e);
				});
		},
		// 阻止触发上级事件
		stopPrevent() {},
		// 购买积分商品
		gobuy() {
			let obj = this
			//判断是否选择地址
			 if(!obj.addressData.real_name) {
				 return obj.$api.msg('请选择收货地址')
			 }
			 console.log(obj.addressData,'addressData')
			
			// 判断用户积分是否足够
			if(obj.userInfo){
				if(obj.userInfo.integral*1 < ((((obj.actionPrice*1)*(obj.goodsNumber*1))*(obj.three_integral*1)).toFixed(2) + obj.goodsObjact.express_fee*1)){
					return obj.$api.msg('您的积分不足！')
				}
			}
			let senddata = {
				real_name: obj.addressData.real_name,
				user_phone: obj.addressData.phone,
				province: obj.addressData.province,
				city:  obj.addressData.city,
				district: obj.addressData.district,
				user_address: obj.addressData.detail,
				pay_price: (((obj.actionPrice*1)*(obj.goodsNumber*1))*(obj.three_integral*1)).toFixed(2) + obj.goodsObjact.express_fee*1,
				goods_name: obj.goodsObjact.goods_name,
				goods_image: obj.goodsObjact.image[0].url,
				goods_num: obj.goodsNumber,
				spec: obj.specSelected,
				goods_id: obj.goodsObjact.id,
				
			}
			console.log(senddata,'senddata++++')
			jfOrderCreate(senddata).then(res => {
				console.log(res,'res+++++++++++++++++++++')
				this.$api.msg('您已购买成功！')
				getUserInfo({}).then((e) => {
					// 保存返回用户数据
					obj.setUserInfo(e.data);
				})
			})
		}
	}
};
</script>

<style lang="scss">
/*  弹出层 */
.popup {
	position: fixed;
	left: 0;
	top: 0;
	right: 0;
	bottom: 0;
	z-index: 99;
	&.show {
		display: block;

		.mask {
			animation: showPopup 0.2s linear both;
		}

		.layer {
			animation: showLayer 0.2s linear both;
		}
	}

	&.hide {
		.mask {
			animation: hidePopup 0.2s linear both;
		}

		.layer {
			animation: hideLayer 0.2s linear both;
		}
	}

	&.none {
		display: none;
	}

	.mask {
		position: fixed;
		top: 0;
		width: 100%;
		height: 100%;
		z-index: 1;
		background-color: rgba(0, 0, 0, 0.4);
	}

	.layer {
		position: fixed;
		z-index: 99;
		bottom: 0;
		width: 100%;
		min-height: 35vh;
		border-radius: 10rpx 10rpx 0 0;
		background-color: #fff;

		.btn {
			height: 66rpx;
			line-height: 66rpx;
			border-radius: 100rpx;
			background: $uni-color-primary;
			font-size: $font-base + 2rpx;
			color: #fff;
			margin: 30rpx auto 20rpx;
		}
	}

	@keyframes showPopup {
		0% {
			opacity: 0;
		}

		100% {
			opacity: 1;
		}
	}

	@keyframes hidePopup {
		0% {
			opacity: 1;
		}

		100% {
			opacity: 0;
		}
	}

	@keyframes showLayer {
		0% {
			transform: translateY(120%);
		}

		100% {
			transform: translateY(0%);
		}
	}

	@keyframes hideLayer {
		0% {
			transform: translateY(0);
		}

		100% {
			transform: translateY(120%);
		}
	}
}
/* 规格选择弹窗 */
.attr-content {
	padding: 25rpx 30rpx;
	.address-section {
		padding: 30rpx 0;
		background: #fff;
		position: relative;
		border-top: 1px solid $border-color-light;
		.order-content {
			min-height: 100rpx;
			display: flex;
			align-items: center;
			.addAddress {
				text-align: center;
				width: 100%;
				display: flex;
				justify-content: center;
				align-items: center;
				.iconaddition {
					font-size: 55rpx;
					line-height: 1;
					border-radius: 100rpx;
					margin-right: 20rpx;
				}
			}
		}
	
		.iconlocation {
			flex-shrink: 0;
			display: flex;
			align-items: center;
			justify-content: center;
			width: 90rpx;
			color: #888;
			font-size: 44rpx;
		}
	
		.cen {
			display: flex;
			flex-direction: column;
			flex: 1;
			font-size: 28rpx;
			color: $font-color-dark;
		}
	
		.name {
			font-size: 34rpx;
			margin-right: 24rpx;
		}
	
		.address {
			margin-top: 16rpx;
			margin-right: 20rpx;
			color: $font-color-light;
		}
	
		.icon-you {
			font-size: 32rpx;
			color: $font-color-light;
			margin-right: 30rpx;
		}
	
		.a-bg {
			position: absolute;
			left: 0;
			bottom: 0;
			display: block;
			width: 100%;
			height: 5rpx;
		}
	}
	.a-t {
		display: flex;

		image {
			width: 170rpx;
			height: 170rpx;
			flex-shrink: 0;
			border-radius: 8rpx;
		}

		.right {
			display: flex;
			flex-direction: column;
			justify-content: space-around;
			padding-left: 24rpx;
			font-size: $font-sm + 2rpx;
			color: $font-color-base;
			line-height: 42rpx;
			width: 75%;

			.price {
				font-size: $font-lg;
				color: $uni-color-primary;
				margin: 10rpx 0rpx;
			}

			.name {
				font-size: 32rpx;
				color: $font-color-dark;
				// height: 50rpx;
				// overflow: hidden;
				// text-overflow: ellipsis;
				// white-space: nowrap;
				// display: block;
			}

			.selected-text {
				margin-right: 10rpx;
			}
		}
	}

	.attr-list {
		display: flex;
		flex-direction: column;
		font-size: $font-base + 2rpx;
		color: $font-color-base;
		padding-top: 30rpx;
		padding-left: 10rpx;
	}

	.item-list {
		padding: 20rpx 0 0;
		display: flex;
		flex-wrap: wrap;

		text {
			display: flex;
			align-items: center;
			justify-content: center;
			background: #eee;
			margin-right: 20rpx;
			margin-bottom: 20rpx;
			border-radius: 100rpx;
			min-width: 60rpx;
			height: 60rpx;
			padding: 0 20rpx;
			font-size: $font-base;
			color: $font-color-dark;
		}

		.selected {
			background: #ddffdf;
			color: $uni-color-primary;
		}
	}
}

//默认商品底部高度
.goodsBottom {
	height: 160rpx;
}
page {
	background: #f0f0f0;
}
//秒杀、拼团底部高度
.contentBottomHeight {
	height: 110rpx;
	background-color: #5dbc7c;
	width: 750rpx;
	color: #fff;
	font-size: 36rpx;
	letter-spacing:10rpx;
	line-height: 110rpx;
	text-align: center;
}
//默认商品底部高度
.goodsBottom {
	height: 160rpx;
}
/deep/ .iconenter {
	font-size: $font-base + 2rpx;
	color: #888;
}
/deep/ .con_image {
	width: 130rpx;
	height: 130rpx;
	display: inline-block;
	padding: 15rpx;
	image {
		width: 100%;
		height: 100%;
	}
}
/* 商品详情中限制图片大小 */
/deep/ .rich-img {
	width: 100% !important;
	height: auto;
}
.introduce-section {
	position: relative;
	background: #fff;
	padding: 35rpx 0rpx;
	padding-left: 35rpx;
	.title {
		font-size: 32rpx;
		color: $font-color-dark;
		.tip-o {
			color: #ff3334;
			padding-left: 15rpx;
		}
	}
	.shareDate {
		position: absolute;
		top: 25rpx;
		right: 25rpx;
		font-size: 26rpx;
		color: #3d3f46;
		border-radius: 15rpx;
		background-color: #ffffff;
		height: 60rpx;
		line-height: 60rpx;
	}
	.share-img {
		width: 30rpx;
		height: 30rpx;
		position: relative;
		top: 5rpx;
		left: 0;
		margin-right: 10rpx;
	}
	.info {
		color: #999999;
		font-size: 26rpx;
		padding-bottom: 15rpx;
	}
	.progress-box {
		width: 260rpx;
		position: relative;
		margin-top: 15rpx;
		line-height: 10px;
		.number {
			font-size: 17rpx;
			position: absolute;
			z-index: 999;
			top: 3rpx;
			left: 15rpx;
			color: #ffffff;
		}
	}
	.price-box {
		display: flex;
		align-items: baseline;
		height: 64rpx;
		padding: 10rpx 0;
		font-size: 26rpx;
		color: $uni-color-primary;
	}
	.price {
		font-size: $font-lg + 6rpx;
		.text {
			padding-left: 5rpx;
			color: #b0b0b0;
			font-size: 22rpx !important;
		}
	}
	.price-green {
		color: #2dbd59;
		font-size: 28rpx !important;
		text {
			background: #2dbd59;
			color: #ffffff;
			padding: 0rpx 10rpx;
			border-radius: 5rpx;
			font-size: 22rpx !important;
			margin-left: 15rpx;
		}
	}
	.m-price {
		margin: 0 12rpx;
		color: $font-color-light;
		text-decoration: line-through;
		margin-left: 25rpx;
		font-size: 24rpx;
	}
}
.bot-row {
  display: flex;
  align-items: center;
  height: 50rpx;
  font-size: $font-sm;
  color: $font-color-light;
  text {
   flex: 1;
  }
 }
</style>
