123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
-
- import { useState } from 'react'
-
- import ButtontWX from '@/components/ButtontWX'
- import { Textarea, View } from '@tarojs/components'
-
- import Taro from '@tarojs/taro'
- import starOn from '@/assets/icons/comm/starOn.png'
- import starOff from '@/assets/icons/comm/starOff.png'
- import Popup from '@/components/Popup'
- // import { saveEvaluate } from '@/services/mine'
- import { orderEvaluation } from '@/services/order'
- import './style.less'
-
-
-
-
-
-
- export default (props) => {
- const { showCutover, maskClosable, orderId, onClose, goBACK } = props
-
- const scoreList = new Array(5).fill(0)
-
-
- const [textAreaCentent, setTextAreaCentent] = useState('')
-
-
-
- const [evaluate, setEvaluate] = useState({
- sweetScore: 0,
- })
-
-
-
- const [kwCollectNub, setkwCollectNub] = useState(0)
- const kwChange = (e, val) => {
- e.stopPropagation();
- setkwCollectNub(val + 1)
-
- console.log("🚀 ~ file: index.jsx ~ line 49 ~ kwChange ~ val", e, val + 1)
-
- setEvaluate({ sweetScore: val + 1, })
- }
-
-
- const ButtonCancel = () => {
- onClose()
- }
- const ButtonOK = (e) => {
- if (evaluate.sweetScore == 0) {
- Taro.showToast({
- title: '您未评价哦',
- icon: 'none'
- })
- return;
- }
- else {
-
- orderEvaluation({ orderId: orderId, score: kwCollectNub, content: textAreaCentent }).then(() => {
- Taro.showToast({
- title: '评价成功',
- icon: 'success',
- duration: 2000
- }).then(() => {
- setTimeout(() => {
- onClose()
- }, 500);
- })
- })
-
- }
- }
-
-
-
- return (
- <>
-
- {
- showCutover ? <View className='modelBack' >
- <View className='assessModel-box'>
- <view className='item-center-Number' >
- <view className='card-box-star'>
- <text className='card-box-star-text' >满意度:</text>
- {
- scoreList.map((_, index) => {
-
- const src = index < kwCollectNub ? starOn : starOff
- return (
- <image className='card-star-image' key={index} src={src} onClick={(e) => kwChange(e, index)} />
- )
- })
- }
- </view>
-
- </view>
- <Textarea placeholder='请输入评价内容' onInput={(e) => setTextAreaCentent(e.detail.value)} />
- <View className='bottomButtomBox'>
- <ButtontWX onClick={ButtonOK} butText='提交' butWidth={80} butHeight={34} butFontSize={16} butBorderRadius={0} />
- </View>
- </View>
-
-
-
- </View> : <View></View>
- }
- </>
-
-
-
-
-
- )
- }
|