李志伟 3 years ago
parent
commit
0eed418048

+ 0
- 64
src/components/AlreadyUsedMolded/index.jsx View File

@@ -1,64 +0,0 @@
1
-
2
-
3
-import food from '@/assets/icons/ProCard/food.png'
4
-import ProCard_hot from '@/assets/icons/ProCard/ProCard_hot.png'
5
-import formatTime from '@/utils/formatTime'
6
-
7
-import { useState } from 'react'
8
-import './style.less'
9
-
10
-
11
-
12
-
13
-const scoreList = new Array(5).fill(0);
14
-const score = "3.9";
15
-
16
-export default (props) => {
17
-  const [detail, setDetail] = useState({})
18
-
19
-  const star = parseFloat(((detail.sweetScore + detail.environmentScore + detail.serviceScore) / 3).toFixed(1));
20
-
21
-  const { list } = props
22
-
23
-  return (
24
-    <view>
25
-      {
26
-        list.map((item, index) => {
27
-          return (
28
-            <view class='wrapper-box' key={index} >
29
-              <view class='left-complete-one'  >
30
-                <image className='left-image-1' src={ProCard_hot}></image>
31
-                <view className='left-viewText'>
32
-                  返现¥{(item.cashback / 100)?.toFixed(2)}
33
-                </view>
34
-                <view className='title-image' >
35
-                  <image className='image-1' mode='scaleToFill' src={item.poster || []}></image>
36
-                  <image className='image-2' src={food}></image>
37
-                </view>
38
-                <view className='title-content'>
39
-                  <view className='Pro-title'  >
40
-                    <view className='title-text'>
41
-                      {item.packageDescription}
42
-                      <text className='title-money-2'>
43
-                        数量:{item.amount}张
44
-                      </text>
45
-                    </view>
46
-                  </view>
47
-                  <text className='title-money' >¥{(item.unitPrice / 100)?.toFixed(2)}元<text className='title-money-3'>订单编号:{item.orderId}</text></text>
48
-                  <view className='title-time'>
49
-                    核销时间:{" "}
50
-                    {formatTime(item.verifiedDate, "yyyy/MM/dd hh:mm")}
51
-                  </view>
52
-                </view>
53
-              </view>
54
-            </view>
55
-          )
56
-
57
-        })
58
-      }
59
-    </view>
60
-
61
-
62
-
63
-  )
64
-}

+ 0
- 126
src/components/AlreadyUsedMolded/style.less View File

@@ -1,126 +0,0 @@
1
-@whiteColor: #fff;
2
-
3
-.wrapper-box {
4
-  display: flex;
5
-  position: relative;
6
-  margin: 30px auto;
7
-  filter: drop-shadow(0 0 0.9rem rgba(0, 0, 0, 0.12));
8
-
9
-  .left-complete-one {
10
-    padding-top: 87px;
11
-    padding-bottom: 43px;
12
-    position: relative;
13
-    display: flex;
14
-    background: @whiteColor;
15
-    background: radial-gradient(circle at top right, transparent 15px, #fff 0)
16
-        top right,
17
-      radial-gradient(circle at bottom right, transparent 15px, #fff 0) bottom
18
-        right;
19
-    background-size: 100% 60%;
20
-
21
-    width: 100%;
22
-    border-radius: 15px 0px 0px 15px;
23
-    // border-radius: 12px;
24
-
25
-    align-items: center;
26
-    .left-image-1 {
27
-      width: 145px;
28
-      height: 44px;
29
-      position: absolute;
30
-      top: 22px;
31
-    }
32
-    .left-viewText {
33
-      // background-image: url(@Image-ProCard_hot);
34
-      // width: 287px;
35
-      width: auto;
36
-      height: 44.3px;
37
-      position: absolute;
38
-      left: 1px;
39
-      top: 28px;
40
-      font-size: 24px;
41
-      color: @whiteColor;
42
-      font-weight: 600;
43
-    }
44
-    //图片
45
-    .title-image {
46
-      height: 144px;
47
-      margin-left: 20px;
48
-      border-radius: 24px;
49
-      overflow: hidden;
50
-      position: relative;
51
-      .image-1 {
52
-        width: 144px;
53
-        height: 144px;
54
-        margin: 0;
55
-      }
56
-      .image-2 {
57
-        width: 89px;
58
-        height: 34px;
59
-        position: absolute;
60
-        left: 0;
61
-      }
62
-    }
63
-    // 商品标题
64
-    .title-content {
65
-      // padding: 84px 0 56px 20px;
66
-      padding-left: 18px;
67
-
68
-      .Pro-title {
69
-        .title-text {
70
-          width: 375px;
71
-          overflow: hidden;
72
-          text-overflow: ellipsis;
73
-          display: -webkit-box; //必须要
74
-          -webkit-line-clamp: 1;
75
-          -webkit-box-orient: vertical;
76
-          word-break: break-all; /* 多出文本省略号代替 */
77
-          text-align: left;
78
-          font-size: 24px;
79
-          padding-bottom: 10px;
80
-          .title-money-2 {
81
-            height: 19px;
82
-            font-size: 20px;
83
-            font-weight: 400;
84
-            color: #333333;
85
-            padding-left: 40px;
86
-          }
87
-        }
88
-      }
89
-      .title-money {
90
-        width: 58px;
91
-        height: 21px;
92
-        font-size: 24px;
93
-        font-weight: bold;
94
-        color: #333333;
95
-        font-weight: 800;
96
-      }
97
-      .title-time {
98
-        font-size: 24px;
99
-        // padding-top: 20px;
100
-        color: #c0c8d3;
101
-      }
102
-      .title-money-3 {
103
-        font-size: 18px;
104
-        padding-left: 10px;
105
-        color: rgba(102, 102, 102, 0.8);
106
-      }
107
-
108
-      .title-time {
109
-        font-size: 24px;
110
-        padding-top: 20px;
111
-        color: #c0c8d3;
112
-      }
113
-    }
114
-  }
115
-}
116
-
117
-//线条
118
-.right-complete-two::after {
119
-  content: "";
120
-  position: absolute;
121
-  top: 15px;
122
-  margin: 26px auto;
123
-  height: 70%;
124
-  border-left: 1px dashed #595959;
125
-  opacity: 0.12;
126
-}

+ 73
- 51
src/components/CompoentsOrder/AlreadyUsed/index.jsx View File

@@ -6,104 +6,126 @@ import starOff from '@/assets/icons/GuideCheck/starOff.png'
6 6
 import formatTime from '@/utils/formatTime'
7 7
 import food from '@/assets/icons/ProCard/food.png'
8 8
 import Popup from '@/components/Popup'
9
+import {saveEvaluate} from '@/services/mine'
9 10
 import './style.less'
10 11
 
11 12
 
12
-const scoreList = new Array(5).fill(0)
13
-const score = '3.9'
14 13
 
15 14
 
16 15
 
17
-export default (props) => {
18
-  const { showCutover, maskClosable, list, onClose } = props
19 16
 
20
-  const [CollectNub, setCollectNub] = useState(1)
17
+export default (props) => {
18
+  const { showCutover, maskClosable, item, onClose } = props
21 19
 
20
+  
21
+  const scoreList = new Array(5).fill(0)
22 22
   const ButtonCancel = () => {
23 23
     onClose()
24 24
   }
25 25
   const ButtonOK = (e) => {
26
-    onClose()
27
-
26
+    if (evaluate.sweetScore==0||evaluate.environmentScore==0||evaluate.serviceScore==0) {
27
+      Taro.showToast({
28
+        title: '请您给本店点亮小星星哦',
29
+        icon: 'none'
30
+      })
31
+      return;
32
+    }
33
+    else{
34
+      saveEvaluate(evaluate.targetType,evaluate.targetId,evaluate).then((res)=>{
35
+        console.log(res)
36
+      })    
37
+      onClose()
38
+    }
28 39
   }
40
+  const [evaluate,setEvaluate]=useState({
41
+    sweetScore:0,//口味
42
+    environmentScore:0,//环境
43
+    serviceScore:0,//服务
44
+    targetId:'',
45
+    targetType:'shop'
46
+  })
47
+  const [kwCollectNub, setkwCollectNub] = useState(0)
48
+  const kwChange = (val) => {
49
+    setkwCollectNub(val+1)
50
+    setEvaluate({...evaluate,sweetScore:val+1,targetId:item.shopId})
51
+  }
52
+  const [hjCollectNub, sethjCollectNub] = useState(0)
53
+  const hjChange = (val) => {
54
+    sethjCollectNub(val+1)
55
+    setEvaluate({...evaluate,serviceScore:val+1})
29 56
 
30
-  const Nuberr = () => {
31
-    setCollectNub(+1)
57
+  }
58
+  const [fwCollectNub, setfwCollectNub] = useState(0)
59
+  const fwChange = (val) => {
60
+    setfwCollectNub(val+1)
61
+    setEvaluate({...evaluate,environmentScore:val+1})
32 62
   }
33 63
 
34 64
   return (
35 65
     <Popup show={showCutover} maskClosable={maskClosable} onClose={onClose} className='box-content' >
36
-      {/* <AlreadyUsedMolded list={list} /> */}
37
-      {
38
-        list.map((item, index) => {
39
-          return (
40
-            <View class='left-complete-one'  >
41
-              <View className='v1'>
42
-                <View className='left-viewText'>
43
-                  返现¥{(item.cashback / 100)?.toFixed(2)}
44
-                </View>
66
+      <View class='left-complete-one'  >
67
+        <View className='v1'>
68
+          <View className='left-viewText'>
69
+            返现¥{(item.cashback / 100)?.toFixed(2)}
70
+          </View>
71
+        </View>
72
+        <View className='v2'>
73
+          <View className='title-image' >
74
+            <image className='image-1' mode='scaleToFill' src={item.poster || []}></image>
75
+            <image className='image-2' src={food}></image>
76
+          </View>
77
+          <View className='title-content'>
78
+            <View className='Pro-title'  >
79
+              <View className='title-text'>
80
+                {item.packageDescription}
45 81
               </View>
46
-              <View className='v2'>
47
-                <View className='title-image' >
48
-                  <image className='image-1' mode='scaleToFill' src={item.poster || []}></image>
49
-                  <image className='image-2' src={food}></image>
50
-                </View>
51
-                <View className='title-content'>
52
-                  <View className='Pro-title'  >
53
-                    <View className='title-text'>
54
-                      {item.packageDescription}
55
-                    </View>
56
-                    <View className='title-money-2'>
57
-                      数量:{item.amount}张
58
-                    </View>
59
-                  </View>
60
-                  <text className='title-money' >¥{(item.unitPrice / 100)?.toFixed(2)}元</text><text className='title-money-3'>订单编号:{item.orderId}</text>
61
-                  <View className='title-time'>
62
-                    核销时间:{" "}
63
-                    {formatTime(item.verifiedDate, "yyyy/MM/dd hh:mm")}
64
-                  </View>
65
-                </View>
82
+              <View className='title-money-2'>
83
+                数量:{item.amount}张
66 84
               </View>
67 85
             </View>
68
-          )
69
-
70
-        })
71
-      }
86
+            <text className='title-money' >¥{(item.unitPrice / 100)?.toFixed(2)}元</text><text className='title-money-3'>订单编号:{item.orderId}</text>
87
+            <View className='title-time'>
88
+              核销时间:{" "}
89
+              {formatTime(item.verifiedDate, "yyyy/MM/dd hh:mm")}
90
+            </View>
91
+          </View>
92
+        </View>
93
+      </View>
72 94
       <View className='pjLine'></View>
73 95
       <view className='item-center-Number' >
74 96
         {/* 评分 */}
75 97
         <view className='card-box-star'>
76
-          <text className='card-box-star-text' onClick={Nuberr} >口味:</text>
98
+          <text className='card-box-star-text'  >口味:</text>
77 99
           {
78 100
             scoreList.map((_, index) => {
79 101
 
80
-              const src = (index + `${CollectNub}`) < score ? starOn : starOff
102
+              const src = index  < kwCollectNub ? starOn : starOff
81 103
               return (
82
-                <image className='card-star-image' key={index} src={src} onClick={Nuberr} />
104
+                <image className='card-star-image' key={index} src={src} onClick={()=>kwChange(index)} />
83 105
               )
84 106
             })
85 107
           }
86 108
         </view>
87 109
         <view className='card-box-star'>
88
-          <text className='card-box-star-text' onClick={Nuberr} >环境:</text>
110
+          <text className='card-box-star-text' >环境:</text>
89 111
           {
90 112
             scoreList.map((_, index) => {
91 113
 
92
-              const src = (index + `${CollectNub}`) < score ? starOn : starOff
114
+              const src = index  < hjCollectNub ? starOn : starOff
93 115
               return (
94
-                <image className='card-star-image' key={index} src={src} onClick={Nuberr} />
116
+                <image className='card-star-image' key={index} src={src} onClick={()=>hjChange(index)} />
95 117
               )
96 118
             })
97 119
           }
98 120
         </view>
99 121
         <view className='card-box-star'>
100
-          <text className='card-box-star-text' onClick={Nuberr} >服务:</text>
122
+          <text className='card-box-star-text'  >服务:</text>
101 123
           {
102 124
             scoreList.map((_, index) => {
103 125
 
104
-              const src = (index + `${CollectNub}`) < score ? starOn : starOff
126
+              const src = index  < fwCollectNub ? starOn : starOff
105 127
               return (
106
-                <image className='card-star-image' key={index} src={src} onClick={Nuberr} />
128
+                <image className='card-star-image' key={index} src={src} onClick={()=>fwChange(index)} />
107 129
               )
108 130
             })
109 131
           }

+ 8
- 5
src/components/CompoentsOrder/OrderCard/index.jsx View File

@@ -14,7 +14,7 @@ const CouponMedia = CouponCard.Media
14 14
 const Action = CouponCard.Action
15 15
 
16 16
 export default (props) => {
17
-  const { item, setShowCutover } = props
17
+  const { item, setShowCutover,show } = props
18 18
 
19 19
   const handleDetail = () => {
20 20
     if (item.status === 0) {
@@ -46,15 +46,18 @@ export default (props) => {
46 46
     });
47 47
   }
48 48
   //评价
49
-  const evaluation = () => {
49
+  const evaluation = (val) => {
50
+    show(val)
50 51
     setShowCutover(true)
51 52
   }
52 53
   const PayAction =
53 54
     item.status === 0 ? <Action.Icon icon={Pay} text='支付' onClick={handleDetail} /> :
54
-      item.status === 1 && item.isVerified == 0 ? <Action.Icon icon={QRcode} text='扫码核销' onClick={() => onWriteOff(item)} /> :
55
-        item.status === 2 && item.isVerified == 0 ? <Action.Image image={refund} /> :
55
+      item.status === 1 && item.isVerified == false ? <Action.Icon icon={QRcode} text='扫码核销' onClick={() => onWriteOff(item)} /> :
56
+        item.status === 2 && item.isVerified == false ? <Action.Image image={refund} /> :
56 57
           item.status === 9 ? <Action.Image image={Null} /> :
57
-            item.isVerified == 1 ? <Action.Icon icon={Evaluation} text='评价' onClick={() => evaluation()} /> : ''
58
+          item.isVerified == true&&item.isEvaluated==3 ? <Action.Image image={Null} /> :
59
+            item.isVerified == true ? <Action.Icon icon={Evaluation} text='评价' onClick={() => evaluation(item)} /> :'' 
60
+
58 61
 
59 62
   return (
60 63
     <>

+ 1
- 1
src/components/CompoentsOrder/OrderCard/style.less View File

@@ -41,6 +41,6 @@
41 41
 }
42 42
 .OrderNumber {
43 43
   font-size: 20px;
44
-  font-weight: 400;
45 44
   color: #666666;
45
+  padding: 20px 0;
46 46
 }

+ 6
- 4
src/components/CompoentsOrder/complete/index.jsx View File

@@ -77,8 +77,10 @@ export default (props) => {
77 77
       }
78 78
     }
79 79
   }, [IsPull]);
80
-
81
-
80
+  const [ite,setItem]=useState({})
81
+  const show=(val)=>{
82
+    setItem(val)
83
+  }
82 84
   const slideButtonTap = (e) => {
83 85
     deleteOrder(e.orderId || '').then(() => {
84 86
       Taro.showToast({
@@ -109,7 +111,7 @@ export default (props) => {
109 111
           list.length == 0 ?
110 112
             <NoData /> :
111 113
             <view className='complete-boxs'>
112
-              <AlreadyUsed showCutover={showCutover} maskClosable={showCutover} onClose={onClose} list={list} />
114
+              <AlreadyUsed showCutover={showCutover} maskClosable={showCutover} onClose={onClose} item={ite} />
113 115
               {list.map((item, index) => {
114 116
                 /* 待支付 */
115 117
                 if (item.status === 0) {
@@ -125,7 +127,7 @@ export default (props) => {
125 127
                 else if (item.isVerified == 1) {
126 128
                   return (
127 129
                     <view key={`${type}-${item.orderId}`}>
128
-                      <OrderCard item={item} setShowCutover={setShowCutover} />
130
+                      <OrderCard item={item} setShowCutover={setShowCutover} show={show} />
129 131
                     </view>
130 132
                   );
131 133
                 }

+ 1
- 1
src/components/CompoentsOrder/complete/style.less View File

@@ -8,7 +8,7 @@
8 8
 }
9 9
 
10 10
 .complete-boxs {
11
-  margin: 40px auto;
11
+  margin: 20px auto;
12 12
   padding: 0 30px;
13 13
   .foot {
14 14
     width: 100%;

+ 0
- 19
src/services/guide.js View File

@@ -1,19 +0,0 @@
1
-//入住指引模块
2
-import request from '@/utils/request'
3
-
4
-/**
5
- * 民宿详情
6
- * @param {*} id 
7
- * @returns 
8
- * 看home.js里面getHotelDetail
9
- */
10
-/**
11
- * 套餐详情
12
- * @param {*} id 
13
- * @returns 
14
- */
15
-/**
16
- * 套餐列表绑定民宿老板id
17
- * @param {*} id 
18
- * @returns 
19
- */

+ 1
- 11
src/services/mine.js View File

@@ -5,17 +5,7 @@ import request from '@/utils/request'
5 5
  * @param {*} data 
6 6
  * @returns 
7 7
  */
8
- export const saveEvaluation = (data) => request('/taEvaluation', { method: 'post', data })
9
-
10
- /**
11
- * 查看评价详情
12
- * @param {*} id 
13
- * @returns 
14
- */
15
-  export const getEvaluationDetail = (id) => request(`/taEvaluation/${id}`)
16
-
17
- //订单列表用哪个表    
18
-//收藏列表
8
+ export const saveEvaluate = (type,id,data) => request(`/${type}/${id}/evaluate`, { method: 'post', data })
19 9
 
20 10
 /**
21 11
  * 联系我们