evaluate.vue 4.3 KB
<template>
	<view class="evaCon">
		<view class="purNav">
			<view class="purNavBody" @click="goGoodDetail(dataList.goods_id)">
				<view class="">
					<image :src="dataList.images[0]" style="width: 200rpx;height: 200rpx;border-radius: 16rpx;border-radius: 16rpx;" mode=""></image>
				</view>
				<view class="">
					<view class="purBotText">
						<text class="purBodyText">{{dataList.goods_name}}</text>
					</view>
					<view class="purMoney">
						<text class="purFu">¥</text><text class="purFuSum">{{dataList.price}}</text>
					</view>
				</view>
			</view>
		</view>
		<view class="evaNav">
			<view class="evaNavBody">
				<view class="evaPadding">
					<text class="evaXz">请选择</text>
				</view>
				<view class="evaImgAll">
					<view class="evaImg" data-goodType='goodType' @click="selectType(1)">
						<image src="../../../static/image/Frame_17@2x.png" style="width: 88rpx;height: 88rpx;" mode="" v-if="typeIndex!==1"></image>
						<image src="../../../static/image/Frame_5@2x.png" style="width: 88rpx;height: 88rpx;" mode="" v-if="typeIndex==1"></image>
						<text>好评</text>
					</view>
					<view class="evaImg" data-middleType='middleType'  @click="selectType(2)">
						<image src="../../../static/image/Frame_15@2x.png" style="width: 88rpx;height: 88rpx;" mode="" v-if="typeIndex!==2"></image>
						<image src="../../../static/image/Frame_3@2x.png" style="width: 88rpx;height: 88rpx;" mode="" v-if="typeIndex==2"></image>
						<text>中评</text>
					</view>
					<view class="evaImg"  data-chaType='chaType'  @click="selectType(3)">
						<image src="../../../static/image/Frame_13@2x.png" style="width: 88rpx;height: 88rpx;" mode="" v-if="typeIndex!==3"></image>
						<image src="../../../static/image/Frame_1@2x.png" style="width: 88rpx;height: 88rpx;" mode="" v-if="typeIndex==3"></image>
						<text>差评</text>
					</view>
				</view>
			</view>
		</view>
		<view class="evaContent">
			<view class="evaContentText">
				<textarea value="" class="zd_textarea" placeholder="请填写评价"  @input="textareaInput" v-model="areaValue"/>
				</view>
			</view>
		<view class="evaBtn">
			<view class="evaBtnon" @click="publish">
				<text class="evaFa">发布</text>
			</view>
		</view>
	</view>

</template>

<script>
	// import request from '../../utils/request.js'
	import request from '../../../utils/request.js'
	export default {
		onLoad(options) {
			this.id=options.id
			this.indexs=options.index
				this.detailData()
		},
		data() {
			return {
				id:'',
				indexs:'',
				areaValue:'',
				typeIndex:1,
				dataList:'',
			}
		},
		created() {
			
		},
		methods:{				
			selectType(index){
				this.typeIndex=index
			},
			textareaInput(e){
				this.areaValue=e.target.value
			},
			//商品详情
			detailData(){
				if(this.indexs==1){
					request.get('/api/personal/detailBuy',{
						buy_id:this.id
					}).then(res=>{
						this.dataList=res.data.info[0].goods
					}).catch(err=>{
						
					})
				}else{
					request.get('/api/personal/detailSell',{
						sell_id:this.id
					}).then(res=>{
						this.dataList=res.data.info[0].goods
					}).catch(err=>{
						
					})
				}				
			},
			//商品详情
			goGoodDetail(id){
				uni.navigateTo({
					url:'/pages/index/good-details?goos_id='+id
				})
			},
			publish(){
				// if(this.typeIndex==''){
				// 	uni.showToast({
				// 		title:'请选择评价类型',
				// 		icon:'none'
				// 	})
				// }else
				 if(this.areaValue==''){
					uni.showToast({
						title:'请填写评价内容',
						icon:'none'
					})
				}else{
				if(this.indexs==1){
					request.get('/api/personal/faAssess',{
						buy_id:this.id,
						ping_status:this.typeIndex-1,
						content:this.areaValue
					}).then(res=>{
						uni.navigateTo({
							url:'/myPackage/pages/me/purchase'
						})
					}).catch(err=>{
						uni.showToast({
							title:err.msg,
							icon:'none'
						})
					})
				}else{
					request.get('/api/personal/maiAssess',{
						sell_id:this.id,
						ping_status:this.typeIndex,
						content:this.areaValue
					}).then(res=>{
						uni.navigateBack({
						     delta:-1
						})
					}).catch(err=>{
						console.log(err,'err')
						uni.showToast({
							title:err.msg,
							icon:'none'
						})
					})
				}	
				}
				
				
			}
		}
	}
</script>

<style>
	@import url("/common/uni.css");
	@import url("/common/evaluate.css");
</style>